1#!/usr/bin/env ruby
2# frozen_string_literal: true
3
4$position = $depth = $depth2 = 0
5
6def forward(n)
7 $position += n
8 $depth2 += $depth * n
9end
10
11def down(n) = $depth += n
12def up(n) = $depth -= n
13
14eval ARGF.read
15
16puts $position * $depth, $position * $depth2