Harryxun/stf_run huggingface dataset:
primes = [0, 0] + [1]*49999
for i in range(2, 224):
    if primes[i]:
        for j in range(i*i, 50001, i):
            primes[j] = 0
while True:
    try:
        n = int(input())
    except:
        break
    m, o = n-1, n+1
    while not primes[m]:
        m -= 1
    while not primes[o]:
        o += 1
    print(m, o)

### FIXED CODE ###

primes = [0, 0] + [1]*50020
for i in range(2, 226):
    if primes[i]:
        for j in range(i*i, 50021, i):
            primes[j] = 0

while True:
    try:
        n = int(input())
    except:
        break
    print(n-primes[n-1::-1].index(1)-1, n+primes[n+1:].index(1)+1)
a, b = map(int, input().split())
al = [1]
bl = [1]
for i in range(2, min(int(a**0.5+1), int(b**0.5+1))):
    if a%i==0:
        resa, resb = a, b
        while resa%i==0:
            resa //= i
        al.append(i)
    if b%i==0:
        while resb%i==0:
            resb //= i
        bl.append(i)
print(len(set(al)&set(bl))) 

### FIXED CODE ###

def prime_factorize(n):
    res = []
    while n % 2 == 0:
        res.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            res.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        res.append(n)
    return res
from fractions import gcd
a, b = map(int, input().split())
print(len(set(prime_factorize(gcd(a, b))))+1)
n, k = map(int, input().split())
a = list(map(int, input().split()))

zyun = [a[0]]
alr = [False]*n
alr[0] = True
crr = a[0]

key = True

while key:
    if not alr[crr - 1]:
        alr[crr - 1] = True
        crr = a[crr - 1]
        zyun.append(crr)
        continue
    else:
        index1 = crr
        key = False

p = zyun[index1]
# print(zyun, p, zyun.index(p))

if zyun.index(p) - 1 == 0:
    zyun1 = zyun
    zyun2 = zyun
else:
    zyun1 = zyun[:zyun.index(p)]
    zyun2 = zyun[zyun.index(p):]

print(zyun1, zyun2)

if len(zyun1) >= k:
    ind = len(zyun1) % k
    if ind == 0:
        print(zyun1[-1])
    else:
        print(zyun1[ind - 1])
else:
    ind = (k - len(zyun1)) % len(zyun2)
    if ind == 0:
        print(zyun2[-1])
    else:
        print(zyun2[ind - 1])

### FIXED CODE ###

n, k = map(int, input().split())
a = [int(n) - 1 for n in input().split()]  # indexに合うように調整する
v = [-1] * n  # 到達してるかどうかを格納するリスト

D = [0]  # Dは循環するもののindexを格納する
v[0] = 0  # 初期スタート位置の到達ステータスは0

cur = a[0]  # 初期位置はindex=0
i = 1

while v[cur] == -1:
    D.append(cur)
    v[cur] = i # 到達済みに変更(iは何番目に到達したか）
    if k == i:  # 循環が発生する前にkの上限に達してしまった場合
        print(cur + 1)
        exit()

    i += 1
    cur = a[cur]

# 循環している場合を考える
k -= v[cur]  # 1回目の到達点を引く
k %= (i - v[cur])  # kを循環する回数で割った余りを考える = 循環した中でどれかという事が分かる

print(D[v[cur] + k] + 1)  # v[cur]で循環しない部分を表し、kで循環した中でどこかを表す
n,k = map(int,input().split())
h = list(map(int, input().split()))

dp = [0] * n
for i in range(k):
     dp[i]=abs(h[0]-h[i])
for i in range (k,n):
     dp[i] = min([dp[i-j-1]+abs(h[i-j-1]-h[i]) for j in range(k)])

print(dp[n-1])


### FIXED CODE ###

import numpy as np
N, K = (int(i) for i in input().split())  
h = np.array([int(i) for i in input().split()])
 
dp = np.empty(N, dtype='int')
 
for i in range(N):
  if i == 0:
    dp[i] = 0
  elif i - K < 0:
    dp[i] = np.min(np.abs(h[i] - h[:i]) + dp[:i])
  else:
    dp[i] = np.min(np.abs(h[i] - h[i-K:i]) + dp[i-K:i])
 
print(dp[N-1])
n = input()
a1 = n%10
a2 = (n-a1)%100
a3 = (n-a1-a2)/100
if a1==a3:
    print("Hello World")

### FIXED CODE ###

n=int(input())
a1 = n % 10
a2 = (n - a1) % 100
a3 = (n - a1 - a2) / 100
if a1 == a3:
    print("Yes")
else:
    print("No")
a=inout().split(' ')
n=int(a[0])
sum=int(a[1])
b=9999999
for i in range(n):
    c=int(input())
    sum-=c
    if b>c:
        b=c
print(sum//b)

### FIXED CODE ###

a=input().split(' ')
n=int(a[0])
sum=int(a[1])
b=9999999
for i in range(n):
    c=int(input())
    sum-=c
    if b>c:
        b=c
print(n+sum//b)
a, b = map(int, input().split())


takahashi = 0
 
# till last month
for x in range(1, a-1):
    for y in range(1, 31):
        if x == y:
            takahashi += 1
 
for x in range(i, b+1):
    if x == a:
        takahashi += 1
print(takahashi)

### FIXED CODE ###

a, b = map(int, input().split())
takahashi = 0
 
for x in range(1, a):
    for y in range(1, 31):
        if x == y:
            takahashi += 1
 
for x in range(1, b+1):
    if x == a:
        takahashi += 1
print(takahashi)
#! /usr/bin/env python3

# from fractions import gcd
from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement

S = input()

if S[2] == S[3] and S[4] == S[5]:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

S = input()

def solve(S):
    if S[2] == S[3] and S[4] == S[5]:
        return "Yes"
    else:
        return "No"

print(solve(S))
import math
t = int(input())
abcd_list = [[int(i) for i in input().split()] for _ in range(t)]

for i in range(len(abcd_list)):
    a, b, c, d = abcd_list[i]
    _a = a
    is_ok = True
    for j in range(10000):
        if b > a:
            is_ok = False
            break
        if b > d:
            is_ok = False
            break
        if c > b:
            is_ok = True
            break
        g = math.gcd(b, d)
        max_mod_b = b - g + a & g
        if max_mod_b > c:
            print('Yes')
        else:
            print('No')


### FIXED CODE ###

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
t = int(input())
abcd_list = [[int(i) for i in input().split()] for _ in range(t)]

for i in range(len(abcd_list)):
    a, b, c, d = abcd_list[i]
    if b > a:
        print("No")
        continue
    if b > d:
        print("No")
        continue
    if c > b:
        print('Yes')
        continue
    g = gcd(b, d)
    max_mod_b = b - g + a % g
    if max_mod_b > c:
        print('No')
    else:
        print("Yes")
N = int(input())
for i in range(N//4 + 1):
  for j in range(N//7 + 1):
	if 4*i + 7*j == N:
	  print("Yes")
	  break
  else:
    continue
else:
  print("No")


### FIXED CODE ###

N = int(input())
fmax = int(N/4)+1
smax = int(N/7)+1
for i in range(fmax+1):
  for j in range(smax+1):
    if (4*i+7*j) == N:
      print('Yes')
      exit()
print('No')
import sys
from collections import Counter

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def main():
    s = input()
    N = len(s)
    K = ii()

    if N <= 50:
        A = set()
        for i in range(N):
            for j in range(i, N):
                A.add(s[i:j+1])
        A = list(A)
        A.sort()
        print(A[K-1])
    else:
        A = list(s)
        A.sort()
        c = A[0]
        l = []
        for i in range(N):
            if s[i] == c:
                l.append(i)
        x = set()
        for v in l:
            for i in range(len(s[v:v+5])):
                x.add(s[v:v+i+1])
        x = list(x)
        x.sort()
        print(x[K-1])



if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
from collections import Counter

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def main():
    s = input()
    N = len(s)
    K = ii()

    A = set()
    for i in range(N):
        for j in range(K):
            A.add(s[i:i+j+1])
    A = list(A)
    A.sort()
    print(A[K-1])


if __name__ == '__main__':
    main()
a,b=map(int(input().split()))
if a%2==0 or b%2==0:print("Even")
else:print("Odd")


### FIXED CODE ###

a,b=map(int,input().split())
if a%2==0 or b%2==0:print("Even")
else:print("Odd")
x=input();a=999
while i<len(x)-2:a=min(abs(int(x[i:i+3])-753),a);i+=1
print(a)

### FIXED CODE ###

x=input()
ans=abs(int(x[0:3])-753)
for i in range(len(x)-2):
    if abs(int(x[i:i+3])-753)<ans:
        ans=abs(int(x[i:i+3])-753)
print(ans)
def solve(string):
    ins = string.split("\n")
    h, w = map(int, ins[0].split(" "))
    a = [list(map(lambda x: int(x) % 2, _i.split(" "))) for _i in ins[1:]]
    move = []
    for j in range(h):
        for i in range(w):
            if a[j][i] == 0:
                continue
            if i < w - 1:
                a[j][i + 1] += 1
                move.append("{} {} {} {}".format(j + 1, i + 1, j + 1, i + 2))
            elif j < h - 1:
                a[j][i] -= 1
                a[j + 1][i] += 1
                move.append("{} {} {} {}".format(j + 1, i + 1, j + 2, i + 1))
    return "{}\n{}".format(len(move), "\n".join(move))


if __name__ == '__main__':
    line = input()
    tmp = [line]
    for _ in range(int(line[0])):
        tmp.append(input())
    print(solve('\n'.join(tmp)))


### FIXED CODE ###

h,w = map(int,input().split())
a = []
for i in range(h):
    tmp = list(map(lambda x:int(x)%2,input().split()))
    a.append(tmp)
result = []
 
for i in range(h):
    for j in range(w-1):
        if a[i][j] == 1:
            #a[i][j] == 0
            a[i][j+1] = 1 ^ a[i][j+1]
            result.append((i+1,j+1,i+1,j+2)) 
for i in range(h-1):
    if a[i][w-1] == 1:
        a[i+1][w-1] = 1 ^ a[i+1][w-1]
        result.append((i+1,w,i+2,w))
print(len(result))
for row in result:
    print("{} {} {} {}".format(row[0],row[1],row[2],row[3]))
import math
import numpy as np

N, D = map(int, input().split())
X = [[int(i) for i in input().split()] for i in range(N)]

is_int = 0
for i in range(N-1):
  for j in range(i+1, N-i):
    l1 = np.array(X[i])
    l2 = np.array(X[j])
    d = math.sqrt(sum((l1-l2)**2))
    if isinstance(d, int):
      is_int += 1
      print(is_int)

### FIXED CODE ###

A = list(map(int, input().split())) 

def func(n, a, b):
  if (n*a > b):
    print(b)
  else:
    print(n*a)
    
func(A[0], A[1], A[2])
import fractions
N = int(input())
values = ([int(x) for x in input().split()])

gcd_from_the_left = []
gcd_from_the_left.append(values[0])
for i in range(N):
	gcd_from_the_left.append(fractions.gcd(gcd_from_the_left[i],values[i]))
gcd_from_the_left.pop(0)

gcd_from_the_right = []
gcd_from_the_right.append(values[-1])
for i in range(N):
	gcd_from_the_right.append(fractions.gcd(gcd_from_the_right[i],values[-i-1]))

gcd_from_the_right.pop(0)

ans = 0
gcd = 0

for i in range(N):
  gcd = fractions.gcd(gcd_from_the_left[i],gcd_from_the_right[-(N-3+i)])
  if gcd > ans:
    ans = gcd
    
gcd = gcd_from_the_left[-2]
if gcd > ans:
  ans = gcd
gcd = gcd_from_the_right[-2]
if gcd > ans:
  ans = gcd
print(ans)



### FIXED CODE ###

import fractions
N = int(input())
values = ([int(x) for x in input().split()])

gcd_from_the_left = []
gcd_from_the_left.append(values[0])
for i in range(N):
	gcd_from_the_left.append(fractions.gcd(gcd_from_the_left[i],values[i]))
gcd_from_the_left.pop(0)

gcd_from_the_right = []
gcd_from_the_right.append(values[-1])
for i in range(N):
	gcd_from_the_right.append(fractions.gcd(gcd_from_the_right[i],values[-i-1]))

gcd_from_the_right.pop(0)

ans = 0
gcd = 0

for i in range(N-2):
  gcd = fractions.gcd(gcd_from_the_left[i],gcd_from_the_right[N-i-3])
  if gcd > ans:
    ans = gcd
    
gcd = gcd_from_the_left[-2]
if gcd > ans:
  ans = gcd
gcd = gcd_from_the_right[-2]
if gcd > ans:
  ans = gcd
print(ans)
def ints():
  return [int(x) for x in input().split()]
def ii():
  return int(input())

n, k = ints()
R, S, P = ints()
cpu = input()
jibun = [0] * n

w = ['r', 's', 'p']

for i in range(n):
  c = cpu[i]
  if c=='r':
    t = ['p']
  elif c=='s':
    t = ['r']
  else:
    t = ['s']

  j = i-k
  if j>=0:
    o = jibun[j]
    te = t[0]
    if te in o:
      if len(o)==1:
        ww = w.copy()
        ww.remove(te)
        t = ww
      else:
        o.remove(te)

  jibun[i] = t

s = 0
for i in range(n):
  w = jibun[i][0]+cpu[i]
  if w=='rs':
    s += R
  elif w=='sp':
    s += S
  elif w=='pr':
    s += P
print(s)



### FIXED CODE ###

def ints():
  return [int(x) for x in input().split()]
def ii():
  return int(input())

n, k = ints()
R, S, P = ints()
cpu = input()
jibun = [0] * n

w = ['r', 's', 'p']

for i in range(n):
  c = cpu[i]
  if c=='r':
    t = ['p']
  elif c=='s':
    t = ['r']
  else:
    t = ['s']

  j = i-k
  if j>=0:
    o = jibun[j]
    te = t[0]
    if te in o:
      if len(o)==1:
        ww = w.copy()
        ww.remove(te)
        t = ww
      else:
        o.remove(te)

  jibun[i] = t

s = 0
for i in range(n):
  w = jibun[i][0]+cpu[i]
  if w=='rs':
    s += R
  elif w=='sp':
    s += S
  elif w=='pr':
    s += P
print(s)
# coding=utf-8

import numpy as np

A = []
n, m = map(int, raw_input().split())
for _ in xrange(n):
    A.append(map(int, raw_input().split()))
A = np.array(A)

b = []
for _ in xrange(m):
    b.append(input())
b = np.array(b)

Ab = np.dot(A, b)
for x in Ab:
    print x

### FIXED CODE ###

# coding=utf-8

n, m = map(int, raw_input().split())
A = [map(int, raw_input().split()) for _ in xrange(n)]
b = [input() for _ in xrange(m)]
Ab = [sum([A[i][j] * b[j] for j in xrange(m)]) for i in xrange(n)]
for x in Ab:
    print x
N = int(input())
A_line = map(int, input().split())

A_flags = [0] * pow(10, 8)

for A in A_line:
  A_flags[A-1] += 1

res = 'YES'
for A_flag in A_flags:
  if A_flag >= 2:
    res = 'NO'

print(res)

### FIXED CODE ###

N = int(input())
A_line = list(map(int, input().split()))

A_line.sort()

res = "YES"
for i in range(len(A_line) - 1):
  if A_line[i] == A_line[i + 1]:
    res = "NO"

print(res)
N, L = input().split()
N = int(N)
L = int(L)

apples = list(range(N)) + L
abs_min = min([abs(x) for x in apples])
print(sum[apples] - abs_min*2)

### FIXED CODE ###

N, L = input().split()
N = int(N)
L = int(L)

apples = list(range(N)) 
apples = [x + L for x in apples]
abs_apples = [abs(x) for x in apples]
abs_min_index = abs_apples.index(min(abs_apples))

print(sum(apples) - apples[abs_min_index])
S = input()
  if S == "ARC":
     print("ABC")
  elif S == "ABC":
       print("ARC")


### FIXED CODE ###

S = input()
if S == "ARC":
   print("ABC")
elif S == "ABC":
     print("ARC")
N,R=map(int,input().split())
if N>=10:
  print('R')
else:
  print(R+100*(10-K))

### FIXED CODE ###

N,R=map(int,input().split())
if N>=10:
  print(R)
else:
  print(R+100*(10-N))
from collections import deque
import sys
input = sys.stdin.readline

n, m = map(int, input().split())
G = [[] for _ in range(n+1)]
for _ in range(m):
    u, v, s = map(int, input().split())
    G[u].append((v, s))
    G[v].append((u, s))
val = [None] * (n+1)
val[1] = (1, 0)
queue = deque([1])
while queue:
    u = queue.popleft()
    for v, s in G[u]:
        if val[v]:
            continue
        val[v] = (-val[u][0], s - val[u][1])
        queue.append(v)
ma = float('inf')
mi = 1
x = -1
for u in range(1, n+1):
    if val[u][0] == -1:
        ma = min(ma, val[u][1] - 1)
    else:
        mi = max(mi, -val[u][1] + 1)
    for v, s in G[u]:
        if u > v:
            continue
        if val[u][0] + val[v][0] == 0:
            if val[u][1] + val[v][1] != s:
                print(0)
                exit()
        else:
            a = val[u][0] + val[v][0]
            b = s - (val[u][1] + val[v][1])
            if a < 0:
                b *= -1
            if b <= 0 or b % 2 == 1:
                print(0)
                exit()
            if x == -1:
                x = b // 2
            elif x != b // 2:
                print(0)
                exit()
assert x == -1
print(max(ma - mi + 1, 0) if x == -1 else 1)

### FIXED CODE ###

from collections import deque
import sys
input = sys.stdin.readline

n, m = map(int, input().split())
G = [[] for _ in range(n+1)]
for _ in range(m):
    u, v, s = map(int, input().split())
    G[u].append((v, s))
    G[v].append((u, s))
val = [None] * (n+1)
val[1] = (1, 0)
queue = deque([1])
while queue:
    u = queue.popleft()
    for v, s in G[u]:
        if val[v]:
            continue
        val[v] = (-val[u][0], s - val[u][1])
        queue.append(v)
ma = float('inf')
mi = 1
x = -1
for u in range(1, n+1):
    if val[u][0] == -1:
        ma = min(ma, val[u][1] - 1)
    else:
        mi = max(mi, -val[u][1] + 1)
    for v, s in G[u]:
        if u > v:
            continue
        if val[u][0] + val[v][0] == 0:
            if val[u][1] + val[v][1] != s:
                print(0)
                exit()
        else:
            a = val[u][0] + val[v][0]
            b = s - (val[u][1] + val[v][1])
            if a < 0:
                b *= -1
            if b <= 0 or b % 2 == 1:
                print(0)
                exit()
            if x == -1:
                x = b // 2
            elif x != b // 2:
                print(0)
                exit()
if x != -1:
    if mi <= x <= ma:
        print(1)
    else:
        print(0)
else:
    print(max(ma - mi + 1, 0))
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value

H, W = mi()
C = li2(10)
A = li2(H)

D = dp2(0, 10, 10)

for i in range(10):
    for j in range(10):
        D[i][j] = C[i][j]

for k in range(10):
    for i in range(10):
        for j in range(10):
            C[i][j] = min(C[i][j], C[i][k]+C[k][j])

ans = 0
for i in range(H):
    for j in range(W):
        if abs(a[i][j]) != 1:
            ans += C[a[i][j]][1]

print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
'''
def check(A):
    num = A[1]
    for i in range(10):
        if A[i] >= num and i!=1:
            A[i] = INF
    print('check', A)
    for i in range(10):
        if A[i]!=INF and A[i]!=0 and i!=1:
                return True
    return False


def dfs(A):
    k = check(A)
    while k:
        for i in range(10):
            if i!= 1 and A[i] != INF:
                for j in range(10):
                    if A[j] != INF:
                        A[j] = min(A[i]+C[i][j], A[j])
                        if j == 1 and A[j]==A[i]+C[i][j]:
                            A[i] = INF
        print('dfs', A)
        k = check(A)
    print(A)
    return A[1]

    

H, W = mi()
C = li2(10)
a = li2(H)
ans = 0

INF = 10**9
memo = [INF]*10

for i in range(10):
    if i!= 1:
        A = []
        for j in range(10):
            A.append(C[i][j])
        print(A)
        memo[i] = dfs(A)
        print(i, memo[i])

for i in range(H):
    for j in range(W):
        if a[i][j] != -1 and a[i][j] != 1:
            ans += memo[a[i][j]]

print(memo)

print(ans)
'''
H, W = mi()
C = li2(10)
a = li2(H)
memo = [C[i][1] for i in range(10)]
flag = -1

def dfs(column, m):
    #print('a')
    if column == 1:
        global flag
        flag = max(m, flag)
    for i in range(10):
        if i!=column and C[column][i] < m:
            dfs(i, m-C[column][i])
    return False

for i in range(10):
    if i != 1:
        dfs(i, C[i][1])
        #print(flag)
        if flag != -1:
            memo[i] = C[i][1]-flag
            #print(i, flag)
        flag = -1
    #print(memo)

ans = 0

for i in range(H):
    for j in range(W):
        if abs(a[i][j]) != 1:
            ans += memo[a[i][j]]
#print(memo)
print(ans)
# ABC057 D - Maximum Average Sets
from collections import defaultdict
from math import factorial
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
def perm(n,r):
    return factorial(n)//factorial(n-r)

def comb(n,r):
    return perm(n,r)//factorial(r)

n,a,b=nm()
V=nl()

d=defaultdict(int)
for vv in V:
    d[vv]+=1

value=0
cnt=0
ans=0

V=list(set(V))
if len(V)==1:
    print(V[0])
    print(2**(b-a+1)-1)
    exit()

for k,v in sorted(d.items(),key=lambda x:x[0],reverse=True):
    if a==0:
        if b==v:
            print(k)
            print(2**b-1)
            exit()
        break
    elif a>=v:
        value+=k*v
        cnt+=v
        a-=v
        b-=v
    elif a<v:
        for i in range(a,b):
            value+=k*i
            cnt+=i
            nn=v
            kk=i
            ans=comb(nn, kk)
        break
print(value/cnt)
print(ans)






### FIXED CODE ###

# ABC057 D - Maximum Average Sets
from collections import defaultdict
from math import factorial
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
def perm(n,r):
    return factorial(n)//factorial(n-r)
 
def comb(n,r):
    return perm(n,r)//factorial(r)

n,a,b=nm()
v=sorted(nl(), reverse=True)

if v[0]==v[a-1]:
    n = 0
    for vv in v:
        if vv!=v[0]: break
        n += 1

    ans = 0
    for k in range(a, min(b,n)+1):
        ans += comb(n, k)

else:
    n = k = 0
    for i,vv in enumerate(v):
        if vv==v[a-1]:
            if i<a: k += 1
            n += 1
    ans = comb(n,k)

print(sum(v[:a])/a)
print(ans)
k=int(input())
d=0
for a in range(1,k+1) :
    for b in range(1,k+1):
        for c in range(1,k+1):
            d+=gcd(a,b,c)
print(d)

### FIXED CODE ###

import math
d=0
k=int(input())
for a in range(1,k+1) :
    for b in range(1,k+1):
        x=math.gcd(a,b)
        for c in range(1,k+1):
            d+=math.gcd(x,c)
print(d)
X = int(raw_input())
if X==3 or X==5 or X==7:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

X = int(input())
if X==3 or X==5 or X==7:
    print("YES")
else:
    print("NO")
# 繰り返しの始まり + 繰り返し + 途中で終わった繰り返し分
N,X,M = map(int,input().split())

cnt = [False] + [1] + [0] * (M-1)
numbers = [X]
ans = 0
for n in range(N):
  X = pow((X % M),2)%M
  cnt[X] += 1
  if (cnt[X] >= 2) or X == 0:
    break
  else:
    numbers.append(X) 

if X == 0:
  print(sum(numbers))
  exit()

repeat_before = numbers[0:numbers.index(X)]
repeat = numbers[numbers.index(X):X]

repeat_cnt,mod  = divmod(N-numbers.index(X),len(repeat))


print(sum(repeat_before) + sum(repeat) * repeat_cnt + sum(repeat[:mod]))

### FIXED CODE ###

# 繰り返しの始まり + 繰り返し + 途中で終わった繰り返し分
N,X,M = map(int,input().split())
p = [0] * (M+2)
sum = [0] * (M+2)
p[X] = 1
sum[1] = X

repeat_start = 0
repeat_end = 0

for i in range(2,N+1):
  X = (X**2) % M
  if p[X] != 0:
    repeat_start = p[X]
    repeat_end = i
    break
  else:
    sum[i] = sum[i-1] + X
    p[X] += i

if repeat_start == 0:
  print(sum[N])
else:
  repeat_cnt,mod=divmod(N-repeat_start+1,repeat_end-repeat_start)
  print(repeat_cnt*(sum[repeat_end-1]-sum[repeat_start-1]) + sum[repeat_start+mod-1])
M=[0,1,-1,0,0,1,1,2,3,3,4,4]
def L(y,m):
  if m<=2: y-=1
  return y/4-y/100+y/400+M[m]

while 1:
  a,b,c,d,e,f=x=map(int,raw_input().split(" "))
  if any([i<0 for i in x]): break
  ans=(d-a)*365+(e-b)*30+f-c+L(d,e)-L(a,b)
  print ans

### FIXED CODE ###

import datetime as D
while 1:
  a,b,c,d,e,f=map(int,raw_input().split())
  try: print (D.date(d,e,f)-D.date(a,b,c)).days
  except: break
A=abs
h,y,x=max([list(map(int,t.split()[::-1]))for t in open(0)][1:])
r=range(101)
for i in r:
 for j in r:H=h+A(x-j)+A(y-i);print(*(j,i,H)*all(u==max(H-A(s-j)-A(t-i),0)for u,t,s in p))

### FIXED CODE ###

#!/usr/bin/env python3
a = abs
z = [list(map(int, input().split())) for _ in range(int(input()))]
z.sort(key = lambda x: x[2])
x, y, h = z[-1]
r = range(101)
for c in r:
    for d in r:
        H = h + a(c-x) + a(d-y)
        if all(u == max(H - a(s-c) - a(t-d), 0) for s, t, u in z):
            print(c, d, H)
            exit()