m='+=+j[0]*Math.',n='(s*Math.PI/180)',x=y=s=0;require("fs").readFileSync("/dev/stdin","utf8").split('\n').some(function(i){j=i.split(','),eval('x'+m+'sin'+n+',y'+m+'cos'+n),s+=+j[1]});console.log(~~x),console.log(~~y)