#include <bits/stdc++.h>

using namespace std;

typedef pair<int,int> P;
typedef long long ll; 

#define int ll

main(){
	ll a,b;
	int k;

	cin >> a >> b >> k;

	for(int i=0;i<k;i++){
		if(i%2==0){
			a -= a%2;
			b += a/2;
			a -= a/2;
		}else{
			b -= b%2;
			a += b/2;
			b -= b/2;
		}
	}

	cout << a << " " << b << endl;

	return 0;
}

#include <bits/stdc++.h>
#define repp(i,l,r)for(long long i=(l);i<(r);i++)
#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define per(i,n) for (long long i = (n); i >= 0; --i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0;
        while (N % a == 0) {
            ++ex;
            N /= a;
        }
        res.push_back({a, ex});
    }
    if (N != 1) res.push_back({N, 1});
    return res;
}

//ミョ(-ω- ?)
int main() {
    ll a,b;
    cin >> a >> b;
    auto p = prime_factorize(gcd(a,b));
    cout << p.size()+1 << endl;
    return 0;
}