from typing import List


def calculate_submarine_position(contents: List[str]) -> int:
    """Determine relative position of submarine and multiply results.

    Args:
        contents (List[str]): the file contents

    Returns:
        int: horizontal distance (x) * vertical distance (y)

    """
    x = 0
    y = 0
    for line in contents:
        direction, dist_str = line.split()
        distance = int(dist_str)
        if direction == 'forward':
            x += distance
        elif direction == 'up':
            y -= distance
        else: # elif direction == 'down':
            y += distance

    return x * y