#include <cstdio>
#include <cmath>
using namespace std;

int main(void){
    
    float distance=0, angle = 0;
    float position = 90;
    float y = 0, x = 0; 
    float rad;
    
    while(1)
    {
        scanf("%f,%f", &distance, &angle);

        if(distance == 0 && angle == 0)
        {
            break;
        }
        
        rad = M_PI*(position/180);
        
        x += distance*cos(rad);
        y += distance*sin(rad);
        
        position -= angle;
        
    }
    
    
    printf("%d\n%d\n", (int)x,(int)y);
    
    return 0;
}
