#include <algorithm>
#include <cmath>
#include <ctime>
#include <climits>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
#include <cstring>
#include <tuple>
#include <bitset>
#include <unordered_map>

using namespace std;

int main() {
    ios::sync_with_stdio(false);

    double x = 0, y = 0;
    double deg = 90;
    const double PI = atan(1.0) * 4.0;

    int a, b;
    char c;
    while (cin >> a >> c >> b && (a || b)) {
        x += a * cos(deg * PI / 180.0);
        y += a * sin(deg * PI / 180.0);
        deg = deg - b;
    }
    cout << (int)x << endl;
    cout << (int)y << endl;

    return 0;
}