main :: IO ()
main = do
  i <- getContents
  let input = map parse . lines $ i
      (x, y, _) = foldl proc (0, 0, 0) input
  print $ truncate x
  print $ truncate y

parse :: String -> (Double, Double)
parse s = (read xs, read $ tail ys)
  where (xs, ys) = break (==',') s

proc :: (Double, Double, Double) -> (Double, Double) -> (Double, Double, Double)
proc (x, y, d) (a, d') = (x', y', d + d')
  where r = d * pi / 180
        x' = x + a * sin r
        y' = y + a * cos r