depth = 0 forw = 0 for s in open("input.txt", 'r').read().splitlines(): split = s.split() match split[0]: case "forward": forw += int(split[1]) case "down": depth += int(split[1]) case "up": depth -= int(split[1]) print(depth*forw)