#include <bits/stdc++.h>
using namespace std;

#define For(i,a,b) for(int (i) = (a);(i) < (b);i++)
#define Rep(i,n) For((i),0,(n))
#define All(a) (a).begin(),(a).end()
#define sp " "
#define INF 1e18
#define INT_INF 1e9
#define MAX 1000

typedef long long ll;
const ll MOD = 1000000007;
const ll MOD_9 = 998244353;

int main(){
    ll N;
    ll A,B;
    cin >> N >> A >> B;
    N %= 12;
    ll p[2][12];
    p[0][0] = A;
    p[1][0] = B;
    Rep(i,11){
        if(i % 2 == 0){
            p[0][i+1] = p[0][i]-p[1][i];
            p[1][i+1] = p[1][i];
        }else{
            p[1][i+1] = p[0][i]+p[1][i];
            p[0][i+1] = p[0][i];
        }
        //cout << p[0][i+1] << sp << p[1][i+1] << endl;
    }
    cout << p[0][N] << sp << p[1][N] << endl;
    //cin >> N;
}
