import Data.List.Split
main = do
  s <- getContents
  let v = map (map (read::String->Double) . splitOn ",") . lines $ s
  let [x,y] = aux [0.0,0.0] 90.0 v
  putStrLn . show . truncate $ x
  putStrLn . show . truncate $ y

aux :: [Double] -> Double -> [[Double]] -> [Double]
aux [x,y] deg ([di,ai]:xs)
 | di==0 && ai==0 = [x,y]
 | otherwise = aux [x+di*cos(deg*pi/180.0),y+di*sin(deg*pi/180.0)] (deg - ai) xs 