6 lines
133 B
Awk
6 lines
133 B
Awk
|
BEGIN { h = 0; d = 0; a = 0; }
|
||
|
$1 == "forward" { h+=+$2; d+=+$2*a; }
|
||
|
$1 == "up" { a-=+$2 }
|
||
|
$1 == "down" { a+=+$2 }
|
||
|
END { print h*d }
|