#include using namespace std; using i128 = __int128_t; int main() { long long n; cin >> n; long long a, b, c; long long d, e, f; cin >> a >> b >> c; cin >> d >> e >> f; long long lo1 = 1, hi1 = 1; while (true) { long long full = hi1 / b; long long rem = hi1 % b; i128 total = (i128)b * full * (2LL * a + (full - 1) * c) / 2; total += (i128)rem * (a + full * c); if (total >= n) break; hi1 *= 2; } while (lo1 < hi1) { long long mid = lo1 + (hi1 - lo1) / 2; long long full = mid / b; long long rem = mid % b; i128 total = (i128)b * full * (2LL * a + (full - 1) * c) / 2; total += (i128)rem * (a + full * c); if (total >= n) hi1 = mid; else lo1 = mid + 1; } long long kcpc = lo1; long long lo2 = 1, hi2 = 1; while (true) { long long full = hi2 / e; long long rem = hi2 % e; i128 total = (i128)e * full * (2LL * d + (full - 1) * f) / 2; total += (i128)rem * (d + full * f); if (total >= n) break; hi2 *= 2; } while (lo2 < hi2) { long long mid = lo2 + (hi2 - lo2) / 2; long long full = mid / e; long long rem = mid % e; i128 total = (i128)e * full * (2LL * d + (full - 1) * f) / 2; total += (i128)rem * (d + full * f); if (total >= n) hi2 = mid; else lo2 = mid + 1; } long long kupc = lo2; if (kcpc < kupc) cout << "KCPC"; else if (kupc < kcpc) cout << "KUPC"; else cout << "Same"; }