BEGIN { h = 0; d = 0}
$1 == "forward" { h+=+$2 }
$1 == "up" { d-=+$2 }
$1 == "down" { d+=+$2 }
END { print h, d, h*d }