#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int a, b, c, n, m = 1;
int main() {
  cin >> a >> b >> c;
  while (c > 0) {
    n = gcd(a, c);
    c -= n;
    ++m;
    if (c > 0) {
      n = gcd(b, c);
      c -= n;
      ++m;
    }
  }
  if (m % 2 == 0)
    cout << "0";
  else
    cout << "1";
  return 0;
}
