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