import sys
import itertools
import math

curdeg = 0
xstep = 0
ystep = 0
for line in sys.stdin.readlines():
    step, deg = map(int, line.split(","))
    xstep += step * math.cos(math.pi * curdeg / 180)
    ystep += step * math.sin(math.pi * curdeg / 180)
    curdeg += deg 


print("{:.0f}".format(ystep))
print("{:.0f}".format(xstep))