import           Control.Applicative
import           Control.Monad
import           Data.List

toRadians :: Float -> Float
toRadians deg = deg * (pi / 180)

solve :: [(Float, Float)] -> (Float, Float)
solve = fst . foldl f ((0, 0), toRadians 90)
  where f ((x, y), r) (l, nd) = ((x + l * cos r, y + l * sin r), r - toRadians nd)

main :: IO ()
main = getContents >>= printResult . solve . parseInput
  where printResult (x, y) = let rx = round x
                                 ry = round y
                             in  print rx >> print ry

parseInput :: Read a => String -> [(a, a)]
parseInput = map (l2t . words) . lines . map c2s
  where c2s ',' = ' '
        c2s c   = c
        l2t (x:y:_) = (read x, read y)