def calculate_position_part2(infile_path: str) -> int:
    """
    Read input, determine vertical and horizontal position and return the product of the values
    :param infile_path: file path to input file with instructions separated by newlines
    :type infile_path: str
    :return: product of the vertical and horizontal position
    :rtype: int
    """
    horizontal = 0
    vertical = 0
    aim = 0
    with open(infile_path, 'r', encoding='ascii') as commands:
        for command in commands:
            direction, units = command.split(' ')
            units = int(units)
            if direction == 'forward':
                horizontal += units
                vertical += aim * units
            elif direction == 'down':
                aim += units
            elif direction == 'up':
                aim -= units
            else:
                raise ValueError(f'bad command: "{command}"')
    return horizontal * vertical