text: import os.path
  
  import pytest
  
  INPUT_TXT = os.path.join(os.path.dirname(__file__), 'input.txt')
  
  
  def compute(s: str) -> int:
      lines = s.splitlines()
  
      horizontal = 0
      depth = 0
      for line in lines:
          direction, value = line.split()
          value = int(value)
          if direction == "forward":
              horizontal += value
          elif direction == "down":
              depth += value
          elif direction == "up":
              depth -= value
  
      return horizontal * depth
  
  
  INPUT_S = '''\
  forward 5
  down 5
  forward 8
  up 3
  down 8
  forward 2
  '''
  EXPECTED = 150
  
  
  @pytest.mark.parametrize(
      ('input_s', 'expected'),
      (
          (INPUT_S, EXPECTED),
      ),
  )
  def test(input_s: str, expected: int) -> None:
      assert compute(input_s) == expected
  
  
  def main() -> int:
      with open(INPUT_TXT, "r") as f:
          print(compute(f.read()))
  
      return 0
  
  
  if __name__ == '__main__':
      raise SystemExit(main())
  