N = int(input()) A, B, C = map(int, input().split()) D, E, F = map(int, input().split()) def func(n,a,b,c): q, r = divmod(n, b) ret = n * a ret += q * (q-1) * b * c // 2 ret += q * r * c return ret ng = 0 ok = 2 * 10 ** 16 while ok - ng > 1: m = (ok+ng) // 2 if func(m,A,B,C) >= N: ok = m else: ng = m c1 = ok ng = 0 ok = 2 * 10 ** 16 while ok - ng > 1: m = (ok+ng) // 2 if func(m,D,E,F) >= N: ok = m else: ng = m c2 = ok if c1 == c2: print("Same") elif c1 > c2: print("KUPC") else: print("KCPC")