#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll n, t, b;
int fact(long long x, long long t) {
int cnt = 1 + x<=t;
for (int i = 2; i * i <= x; ++i) {
if (x % i == 0) {
++cnt;
long long y = x / i;
if (y <= t)
++cnt;
}
}
return cnt % 2==0;
}
char ans[][4] = { "Off", "On" };
int main(int argc, char **argv) {
#ifndef ONLINE_JUDGE
freopen("a.in", "r", stdin);
#endif
int cas = 1;
while (scanf("%lld %lld %lld", &n, &t, &b) > 0) {
t %= n;
printf("Case %d: %s\n", cas++, ans[fact(b, t)]);
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiNkZWZpbmUgbGwgbG9uZyBsb25nCmxsIG4sIHQsIGI7CmludCBmYWN0KGxvbmcgbG9uZyB4LCBsb25nIGxvbmcgdCkgewogICAgaW50IGNudCA9IDEgKyB4PD10OwogICAgZm9yIChpbnQgaSA9IDI7IGkgKiBpIDw9IHg7ICsraSkgewogICAgICAgIGlmICh4ICUgaSA9PSAwKSB7CiAgICAgICAgICAgICsrY250OwogICAgICAgICAgICBsb25nIGxvbmcgeSA9IHggLyBpOwogICAgICAgICAgICBpZiAoeSA8PSB0KQogICAgICAgICAgICAgICAgKytjbnQ7CiAgICAgICAgfQogICAgfQogICAgcmV0dXJuIGNudCAlIDI9PTA7Cn0KY2hhciBhbnNbXVs0XSA9IHsgIk9mZiIsICJPbiIgfTsKaW50IG1haW4oaW50IGFyZ2MsIGNoYXIgKiphcmd2KSB7CiNpZm5kZWYgT05MSU5FX0pVREdFCiAgICBmcmVvcGVuKCJhLmluIiwgInIiLCBzdGRpbik7CiNlbmRpZgogICAgaW50IGNhcyA9IDE7CiAgICB3aGlsZSAoc2NhbmYoIiVsbGQgJWxsZCAlbGxkIiwgJm4sICZ0LCAmYikgPiAwKSB7CiAgICAgICAgdCAlPSBuOwogICAgICAgIHByaW50ZigiQ2FzZSAlZDogJXNcbiIsIGNhcysrLCBhbnNbZmFjdChiLCB0KV0pOwogICAgfQogICAgcmV0dXJuIDA7Cn0K