#include <iostream>
#include <cmath>
using namespace std;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    double x = 0, y = 0, r = M_PI/2.0;
    int a, b;
    char delim;
    while (cin >> a >> delim >> b, a||b) {
        x += a * cos(r);
        y += a * sin(r);
        r -= b * M_PI / 180.0;
    }
    cout.precision(0);
    cout << fixed;
    cout << x << "\n";
    cout << y << "\n";

    return 0;
}