#include #include #include #define INF 2140000000 using namespace std; void solve() { int a, b, c; cin >> a >> b >> c; vector v(c, INF); int i, j; for (i = 0; i < c; i++) { for (j = 0; j < c; j++) { int tmp = i * a + j * b; v[tmp%c] = min(v[tmp%c], tmp/c); } } int ans = 0; for (i = 0; i < c; i++) { if (v[i] == INF) { cout<<"INF\n"<