#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T,class U> using P = pair<T,U>;
template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,A,B;
    cin >> N >> A >> B;
    N %= 12;
    ll a,b;
    int n = N%6;
    if(n==0){
        a = A,b = B;
    }
    if(n==1){
        a = A-B,b = B;
    }
    if(n==2){
        a = A-B,b = A;
    }
    if(n==3){
        a = -B,b = A;
    }
    if(n==4){
        a = -B,b = A-B;
    }
    if(n==5){
        a = -A,b = A-B;
    }
    if(N>=6) a *= -1,b *= -1;
    cout << a << " " << b << endl;
}
