import Data.List.Split
type Dir = [Double]
type Round = Double

solve :: Round -> Dir -> [Double] -> Dir
solve _ d [] = d
solve r [f,s] (x:y:xs) = solve (y+r) (f+x*sin (pi/180*r) : s+x*cos (pi/180*r):[]) xs

floor' :: Double -> Int
floor' d
  | d < 0 = (0-) $ floor $ -d
  | otherwise = floor d

main = getContents >>= putStr . unlines . map (show . floor') . solve 0 [0,0] . map read . concat . map (splitOn ",") . lines