Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

import sys
N = int(input())


def query(num):
    print(num)
    return int(input())


result = [-1] * N
result[0] = query(0)
edge = [0, N]
if result[0] == 2:
    pass
else:
    for i in range(30):
        idx = int(abs(edge[0] - edge[1]) / 2) + min(edge)
        result[idx] = query(idx)
        if result[idx] == 2:
            sys.stdout.flush()
            break
        for i in range(2):
            r = result[0] if edge[i] == N else result[edge[i]]
            if abs(edge[i] - idx) % 2 == 0:
                if r != result[idx]:
                    if i == 0:
                        edge[1] = idx
                        break
                    else:
                        edge[0] = idx
                        break
            elif abs(edge[i] - idx) % 2 == 1:
                if r == result[idx]:
                    if i == 0:
                        edge[1] = idx
                        break
                    else:
                        edge[0] = idx
                        break
sys.stdout.flush()


### FIXED CODE ###

import sys
N = int(input())


def query(num):
    print(num)
    return input()


result = [-1] * (N + 1)
result[0] = query(0)
result[N] = result[0]
edge = [0, N]
if result[0] == "Vacant":
    sys.stdout.flush()
else:
    for i in range(30):
        idx = int(abs(edge[0] - edge[1]) / 2) + min(edge)
        result[idx] = query(idx)
        if result[idx] == "Vacant":
            sys.stdout.flush()
            break
        for i in range(2):
            r = result[edge[i]]
            if abs(edge[i] - idx) % 2 == 0:
                if r != result[idx]:
                    if i == 0:
                        edge[1] = idx
                        break
                    else:
                        edge[0] = idx
                        break
            elif abs(edge[i] - idx) % 2 == 1:
                if r == result[idx]:
                    if i == 0:
                        edge[1] = idx
                        break
                    else:
                        edge[0] = idx
                        break
    sys.stdout.flush()
### BUGGY CODE ###

N = int(input())
S = []
for i in range(N):
    S.append(int(input()))

hasFinished = False

ans_cand = []
def dfs(cp, length):
    
    if length == N:
        if cp%10 != 0:
            print(cp)
            exit()
            
    else:
        dfs(cp+S[length], length+1)
        dfs(cp, length+1)
        
def ten2zero(num):
    if num%10==0:
        return 0
    else:
        return num        

def solve(N,S):
    S.sort(reverse=True)
    s_per5 = [s%10 for s in S]
    
    if sum(s_per5)==0:
        print(0)
        return
    
    else:    
        return dfs(0,0)

solve(N,S)

### FIXED CODE ###

N = int(input())
S = []
for i in range(N):
    S.append(int(input()))

total = sum(S)

if total%10 == 0:
    
    new_S = []
    for s in S:
        if s%10==0:
            new_S.append(101)
        else:
            new_S.append(s)
    
        if sum(new_S) == 101*len(S):
            min_s = total
        else:
            min_s = min(new_S)
    
    print(total-min_s)
else:
    print(total)
### BUGGY CODE ###

N, K = map(int, input().split())
MOD = 998244353
S = []
for _ in range(K):
    S.append(tuple(map(int, input().split())))

dp = [0] * (N + 1)
dp[1] = 1
sum_list = [0] * (N + 1)
sum_list[1] = 1

for i in range(2, N+1):
    for L, R in S:
        RR = i - L
        if RR <= 0:
            continue
        LL = max(1, i-R)
        if LL <= RR:
            t = sum_list[RR] - sum_list[LL-1]
            dp[i] += t
    sum_list[i] = sum_list[i-1] + dp[i]
    dp[i] %= MOD

print(dp[N])


### FIXED CODE ###

N, K = map(int, input().split())
MOD = 998244353
S = []
for _ in range(K):
    S.append(tuple(map(int, input().split())))

dp = [0] * (N + 1)
dp[1] = 1
sum_list = [0] * (N + 1)
sum_list[1] = 1

for i in range(2, N+1):
    for L, R in S:
        RR = i - L
        if RR <= 0:
            continue
        LL = max(1, i-R)
        if LL <= RR:
            t = sum_list[RR] - sum_list[LL-1]
            dp[i] += t
    sum_list[i] = (sum_list[i-1] + dp[i]) % MOD
    dp[i] %= MOD

print(dp[N])
### BUGGY CODE ###

s = input()

c = [0 for i in range(2019)]
c[0] = 1
mod = 2019
d = 1
x = 0
for i,j in enumerate(s[::-1]):
	x = (x + int(j)*pow(10,i))%mod
	c[x] += 1

ans = 0
for i in range(2019):
	ans += (c[i]*(c[i]-1))//2
print (ans)


### FIXED CODE ###

s = input()

c = [0 for i in range(2019)]
c[0] = 1
mod = 2019
d = 1
x = 0
for i,j in enumerate(s[::-1]):
	x = (x + int(j)*pow(10,i,mod))%mod
	c[x] += 1

ans = 0
for i in range(2019):
	ans += (c[i]*(c[i]-1))//2
print (ans)
### BUGGY CODE ###

import numpy as np

s = input()
t = len(s)

m = np.array([0])
a = 0
for i in reversed(range(0, t)):
    a += 10**(t-i-1) * int(s[i])
    a = a % 2019
    m = np.append(m, a)

n = np.sort(m)

c = 0
d = 0

for i in range(t-1):
    if n[i] == n[i+1]:
        c += 1
        d += c
    else:
        c = 0

print(d)


### FIXED CODE ###

s = input()
t = len(s)

x = []
y = 0

while 10 ** y % 2019 not in x:
    x.append(10 ** y % 2019)
    y += 1

z = len(x)

m = [0 for i in range(2019)]
m[0] = 1
a = 0
for i in reversed(range(0, t)):
    a += x[(t-i-1) % z] * (int(s[i]) % 2019)
    a = a % 2019
    m[a] += 1

def triangle(n):
    if n > 1:
        return n * (n-1) // 2
    else:
        return 0

p = list(map(triangle, m))
# print(p)
print(sum(p))
### BUGGY CODE ###

n, s = int(input()), input()
dp = [0] * (n + 1)
ans = 0
for i in range(n):
    for j in range(n - 1, i, -1):
        if s[i] == s[j]:
            dp[j + 1] = min(dp[j] + 1, j - i)
        else:
          dp[j + 1] = 0
    ans = max(max(dp), ans)
print(ans)

### FIXED CODE ###

n, s = int(input()), input()
dp = [[0] * (n + 1) for i in range(n + 1)]
for i in range(n):
    for j in range(i + 1, n):
        if s[i] == s[j]:
            dp[i + 1][j + 1] = min(dp[i][j] + 1, j - i)
from itertools import chain
print(max(i for i in chain.from_iterable(dp)))
### BUGGY CODE ###

from itertools import permutations
N, C = map(int, input().split())
d = [list(map(int, input().split())) for _ in range(C)]
c = [list(map(int, input().split())) for _ in range(N)]

r0 = []
r1 = []
r2 = []
for i in range(N):
    for j in range(N):
        rest = (i+1+j+1) % 3
        if rest == 0:
            r0.append(c[i][j]-1)
        elif rest == 1:
            r1.append(c[i][j]-1)
        else:
            r2.append(c[i][j]-1)
ans = 10**10
for p in permutations([i for i in range(C)], 3):
    point = 0
    point += sum([d[rest][p[0]] for rest in r0])
    point += sum([d[rest][p[1]] for rest in r1])
    point += sum([d[rest][p[2]] for rest in r2])
    ans = min(ans, point)
print(ans)


### FIXED CODE ###

from itertools import permutations
from collections import deque
from collections import Counter
N, C = map(int, input().split())
d = [list(map(int, input().split())) for _ in range(C)]
c = [list(map(int, input().split())) for _ in range(N)]

r0 = deque()
r1 = deque()
r2 = deque()
for i in range(N):
    for j in range(N):
        rest = (i+1+j+1) % 3
        if rest == 0:
            r0.append(c[i][j]-1)
        elif rest == 1:
            r1.append(c[i][j]-1)
        else:
            r2.append(c[i][j]-1)
c0 = Counter(r0)
c1 = Counter(r1)
c2 = Counter(r2)
ans = 10**10
for p in permutations([i for i in range(C)], 3):
    point = 0
    point += sum([d[k][p[0]]* v for k, v in c0.items()])
    point += sum([d[k][p[1]]* v for k, v in c1.items()])
    point += sum([d[k][p[2]]* v for k, v in c2.items()])
    ans = min(ans, point)
print(ans)
### BUGGY CODE ###

import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N, M = list(map(int, readline().split()))
p = []
S = []
for i in range(M):
    _p, s = readline().decode('utf-8').split()
    p.append(int(_p))
    S.append(s)
p = np.array(p)

AC_list = []
AC_cnt = 0
WA_cnt = 0

for i in range(1, N + 1):
    if i in p:
        S_acc = [s for (s, p_) in zip(S, p) if p_ == i]
        if "AC" in S_acc:
            AC_cnt += 1
            for s in S_acc:
                if s == "WA":
                    WA_cnt += 1
                else:
                    break
print(AC_cnt, WA_cnt)

### FIXED CODE ###

import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N, M = list(map(int, readline().split()))
pS = [readline().decode('utf-8').split() for _ in range(M)]
cnt_list = [0] * (N + 1)
ACed_list = [0] * (N + 1)

for p_, s in pS:
    p_ = int(p_)

    if s == 'AC':
        if ACed_list[p_] == 0:
            ACed_list[p_] = 1
    else:
        if ACed_list[p_] == 0:
            cnt_list[p_] += 1

for i in range(N + 1):
    if ACed_list[i] == 0:
        cnt_list[i] = 0

print(sum(ACed_list), sum(cnt_list))
### BUGGY CODE ###

n = int(input())
t = []
for i in range(n):
    t.append(int(input()))
i = 0
while True:
    i+=1
    flag = True
    for j in range(n):
        if (i*max(t))%t[j] != 0:
            break
        if j == n-1:
            flag = False
    if flag == False:
        break
print(i*max(t))

### FIXED CODE ###

def gcd(a, b):
    while b:
        a, b = b, a%b
    return a
N = int(input())
ans = 1
for i in range(0,N):
    t = int(input())
    ans = t * ans // gcd(ans, t)
print(ans)
### BUGGY CODE ###

from collections import defaultdict
import math

def f(n):
    if n in d:
        d[n] += 1
        return
    
    yakusu = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            yakusu.append(i)
            if i != n // i:
                yakusu.append(n // i)
    for i in yakusu:
        if i != 1:
            d[i] += 1

d = defaultdict(int)
N = int(input())
A = list(map(int, input().split()))

tmp = A[0]
for i in range(1, N):
    tmp = math.gcd(tmp, A[i])
if tmp != 1:
    print('not coprime')
    exit()
A.sort(reverse=True)
for i in A:
    f(i)

for i, v in d.items():
    if v != 1:
        print('setwise coprime')
        exit()

print('pairwise coprime')


### FIXED CODE ###

from collections import defaultdict
import math

INF = 10 ** 6 + 1
is_prime = [1] * INF

def eratorasu():
    is_prime[0] = 0
    is_prime[1] = 0
    for i in range(2, INF):
        if is_prime[i] == 0:
            continue
        for j in range(i * 2, INF, i):
            is_prime[j] = 0
    return

def f(n):
    yakusu = []
    if is_prime[n]:
        yakusu.append(n)
    else:
        for i in range(2, int(n ** 0.5) + 1):
            if n % i == 0:
                yakusu.append(i)
                if i != n //i:
                    yakusu.append(n // i)
                break

    for i in yakusu:
        if i != 1:
            d[i] += 1

eratorasu()
d = defaultdict(int)
N = int(input())
A = list(map(int, input().split()))

tmp = A[0]
for i in range(1, N):
    tmp = math.gcd(tmp, A[i])
    f(A[i])

if tmp != 1:
    print('not coprime')
    exit()
eratorasu()
f(A[0])

for i, v in d.items():
    if v != 1:
        print('setwise coprime')
        exit()

print('pairwise coprime')
### BUGGY CODE ###

N, D, A = map(int, input().split())
XH = [list(map(int, input().split())) for _ in range(N)]
XH.sort(key=lambda x: x[0])

ans = 0
i = 0
while True:
    alive = True
    for j in range(i, N):
        x, h = XH[j]
        if h <= 0:
            continue
        i = j
        pos = x
        explode = (h + A - 1) // A
        break
    else:
        alive = False
        break

    if not alive:
        break

    for j in range(i, N):
        x, _ = XH[j]
        if x <= pos+2 * D:
            XH[j][1] -= explode * A
        else:
            break
    ans += explode

print(ans)


### FIXED CODE ###

from collections import deque
N, D, A = map(int, input().split())
XH = [list(map(int, input().split())) for _ in range(N)]
XH.sort()

que = deque([])
ans = 0
total = 0

for i in range(N):
    x, h = XH[i]
    if h <= 0:
        continue
    while que and XH[i][0] > que[0][0]:
        _, tmp = que.popleft()
        total -= tmp

    h -= total
    if h > 0:
        atk = (h + A - 1) // A
        damage = atk * A
        ans += atk
        total += damage
        que.append((x+2*D, damage))

print(ans)
### BUGGY CODE ###

import math
A, B, N = map(int, input().split())

l = []
for i in range(1, N+1):
  l.append((A*i//B) - A*(i//B))
    
print(max(l))

### FIXED CODE ###

import math
A, B, N = map(int, input().split())

i = min(B-1, N)
ans = (A*i//B) - A*(i//B)
    
print(ans)
### BUGGY CODE ###

k,s=map(int,input().split())
print(sum(x+y+z==s for x in range(k+1) for y in range(k+1) for z in range(k+1)))

### FIXED CODE ###

k,s=map(int,input().split())
print(sum(0<=s-y-z<=k for y in range(k+1) for z in range(k+1)))
### BUGGY CODE ###

x, y, a, b, c = map(int, input().split())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))

P.sort(reverse = True)
Q.sort(reverse = True)
R.sort(reverse = True)

P = P[0:x]
Q = Q[0:y]

while P[-1] < R[0] or Q[-1] < R[0]:
    if Q[-1] >= P[-1]:
        P[-1] = R.pop(0)
        P.sort(reverse = True)
    else:
        Q[-1] = R.pop(0)
        Q.sort(reverse=True)

    if R == []:
        break

print(sum(P) + sum(Q))

### FIXED CODE ###

x, y, a, b, c = map(int, input().split())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))
Pl = 0
Ql = 0
Rb = 0

P.sort(reverse = True)
Q.sort(reverse = True)
R.sort(reverse = True)

P = P[0:x]
Q = Q[0:y]

#while (P[-1 - Pl] < R[0 + Rb] or Q[-1 - Ql] < R[0 + Rb]):
#while (P[-1 - Pl] < R[0 + Rb] or Q[-1 - Ql] < R[0 + Rb]) and (Pl != len(P) or Ql != len(Q)):
while Pl != len(P) or Ql != len(Q):
    if Pl == len(P):
        if Q[-1 - Ql] < R[0 + Rb]:
            Q[-1 - Ql] = R[0 + Rb]
            Ql = Ql + 1
        else:
            break
    elif Ql == len(Q):
        if P[-1 - Pl] < R[0 + Rb]:
            P[-1 - Pl] = R[0 + Rb]
            Pl = Pl + 1
        else:
            break

    elif Q[-1 - Ql] >= P[-1 - Pl] and P[-1 - Pl] < R[0 + Rb]:
        P[-1 - Pl] = R[0 + Rb]
        Pl = Pl + 1
    elif P[-1 - Pl] > Q[-1 - Ql] and Q[-1 - Ql] < R[0 + Rb]:
        Q[-1 - Ql] = R[0 + Rb]
        Ql = Ql + 1

    else:
        break

    Rb = Rb + 1
    if Rb == len(R):
        break

print(sum(P) + sum(Q))
### BUGGY CODE ###

import sys
input = sys.stdin.readline
import heapq
from collections import Counter

H,W,M = map(int, input().split())
BH = [[0,i] for i in range(H)]
BW = [[0,i] for i in range(W)]
Bomb = set()
for _ in range(M):
  h,w = map(int, input().split())
  h,w = h-1,w-1
  BH[h][0] += 1
  BW[w][0] += 1
  Bomb.add((h,w))
  
BH.sort(reverse=True)
BW.sort(reverse=True)
  
"""
print(BombC)
print(BH)
print(BW)
"""

h = []
ans = 0
nowh, noww = 0,0
i,j = 0,0
heapq.heappush(h, (-BH[i][0] - BW[j][0], BH[i][1], BW[j][1], i,j))
while h:
  cost, nowh, noww,i,j = heapq.heappop(h)
  cost = -cost
  #print(cost,nowh,noww)
  if (nowh,noww) not in Bomb:
    ans = max(ans,cost)
    break
  else:
    ans = max(ans, cost-1)
    if i+1 < H:
      heapq.heappush(h, (-BH[i+1][0] - BW[j][0], BH[i+1][1], BW[j][1],i+1, j))
    if j+1 < W:
      heapq.heappush(h, (-BH[i][0] - BW[j+1][0], BH[i][1], BW[j+1][1],i, j+1))
      
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline

H,W,M = map(int, input().split())
BH = [0 for i in range(H)]
BW = [0 for i in range(W)]
Bomb = set()
for _ in range(M):
  h,w = map(int, input().split())
  h,w = h-1,w-1
  BH[h] += 1
  BW[w] += 1
  Bomb.add((h,w))
  
BHMAX = max(BH)
BWMAX = max(BW)
HS = set()
WS = set()
for i in range(H):
  if BH[i] == BHMAX:
    HS.add(i)
for i in range(W):
  if BW[i] == BWMAX:
    WS.add(i)
    
ans = 0
cnt = 0
for h,w in Bomb:
  if h in HS and w in WS:
    ans = max(ans, BHMAX + BWMAX - 1)
    cnt += 1

if cnt < len(HS) * len(WS):
  ans = BHMAX + BWMAX
print(ans)
### BUGGY CODE ###

# D - FT Robot

from collections import deque
import copy

s = list(input())
x, y = map(int, input().split())

if len(s) == 1:
    if (s[0] == "F" and (x, y) == (1, 0)) or (s[0] == "T" and (x, y) == (0, 0)):
        print("Yes")
    else:
        print("No")
    exit()

zipped_s = []
count = 1
for idx in range(len(s) - 1):
    if s[idx] == s[idx+1]:
        count += 1
    else:
        zipped_s.append((s[idx], count))
        count = 1
zipped_s.append((s[-1], count))

n_move = s.count("F")

robot = deque([[[0,0], 0, 0, n_move]]) # 現在地、これから行うzipped_sの操作のインデックス、向き、残り移動回数
while robot:
    r = robot.pop()
    if r[1] == len(zipped_s):
        if r[0] == [x, y]:
            print("Yes")
            exit()
        else:
            continue
    elif r[3] < (abs(r[0][0] - x) + abs(r[0][1] - y)):
        continue
    elif zipped_s[r[1]][0] == "F":
        if r[2] == 0:
            r[0][0] += zipped_s[r[1]][1]
        elif r[2] == 1:
            r[0][1] += zipped_s[r[1]][1]
        elif r[2] == 2:
            r[0][0] -= zipped_s[r[1]][1]
        else:
            r[0][1] -= zipped_s[r[1]][1]
        r[3] -= zipped_s[r[1]][1]
        r[1] += 1
        robot.append(r)
    else:
        if zipped_s[r[1]][1] % 2 == 0:
            r[1] += 1
            robot.append(r)
            r2 = copy.deepcopy(r)
            r2[2] = (r2[2] + 2) % 4
            robot.append(r2)
        else:
            r[1] += 1
            r2 = copy.deepcopy(r)
            r[2] = (r[2] + 1) % 4
            robot.append(r)
            r2[2] = (r2[2] + 3) % 4
            robot.append(r2)
print("No")


### FIXED CODE ###

# D - FT Robot

import copy

s = input()
x, y = map(int, input().split())

f = [len(x) for x in s.split("T")]
x -= f[0]
fx = f[2::2]
fy = f[1::2]

x_possible_set = set([0])
for dx in fx:
    tmp = set()
    for current_x in x_possible_set:
        tmp.add(current_x + dx)
        tmp.add(current_x - dx)
    x_possible_set = tmp.copy()

y_possible_set = set([0])
for dy in fy:
    tmp = set()
    for current_y in y_possible_set:
        tmp.add(current_y + dy)
        tmp.add(current_y - dy)
    y_possible_set = tmp.copy()

print("Yes" if x in x_possible_set and y in y_possible_set else "No")
### BUGGY CODE ###

N, x = map(int,input().split())
a = list(map(int,input().split()))

inf = float('inf')
ans = inf

class SegmentTree:
    def __init__(self, N):
        self.N = 2**(N-1).bit_length()
        self.data = [inf for _ in range(2*self.N)]
    
    def update(self, k, x):
        k += self.N-1
        self.data[k] = x
        while k >= 0:
            k = (k - 1) // 2
            self.data[k] = min([self.data[2*k+1], self.data[2*k+2]])
            
    
    # [l,r)
    def query(self, l, r):
        L = l + self.N
        R = r + self.N
        s = inf
        while L < R:
            if R & 1:
                R -= 1
                s = min([s, self.data[R-1]])
            
            if L & 1:
                s = min([s, self. data[L-1]])
                L += 1
            L >>= 1; R >>= 1
        return s

st = SegmentTree(N)
for i, ai in enumerate(a):
    st.update(i, ai)

def time(i, k):
    if i+k+1 <= N:
        tmp = st.query(i, i+k+1)
    else:
        tmp = min(st.query(0, (i+k) % N + 1), st.query(i, N))
    return tmp

# k回魔法を唱える
for k in range(N):
    res = k*x
    for i in range(N):
        res += time(i, k)
    ans = min(ans, res)

print(ans)

### FIXED CODE ###

N, x = map(int,input().split())
a = list(map(int,input().split()))

inf = float('inf')
ans = inf

time = [[inf] * N for _ in range(N)]

for i in range(N):
    tmp = inf
    for k in range(N):
        ni = i + k
        if ni > N - 1:
            ni %= N
        tmp = min(tmp, a[ni])
        time[i][k] = tmp

# k回魔法を唱える
for k in range(N):
    res = k*x
    for i in range(N):
        res += time[i][k]
    ans = min(ans, res)

print(ans)
### BUGGY CODE ###

n = int(input())
ans = 0
for i in range(1,n+1):
  if i != n:
    ans += i%(i+1)
  else:
    ans += i%1
print(ans)
  
  

### FIXED CODE ###

import math
n = int(input())
print(math.floor(((n-1)*(n-1+1))//2))
### BUGGY CODE ###

n = int(input())
l = list(map(int,input().split()))
l.sort(reverse=True)
ans = 0

for i in range(n-2):
    flag = 0
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            if l[i] < l[j] + l[k]:
                ans += 1
            elif k-j == 1:
                flag = 1
                break
            else:
                break
        if flag:
            break

print(ans) 

### FIXED CODE ###

import bisect

n = int(input())
l = list(map(int,input().split()))
l.sort()
ans = 0

for i in range(n-2):
    for j in range(i+1,n-1):
        ind = bisect.bisect_left(l,l[i]+l[j])
        ans += ind-j-1

print(ans)
### BUGGY CODE ###

N = int(input())
A = [int(i) for i in input().split()]

ans = 10 ** 18
for i in range(1,N):
#     print("すぬけ",A[0:i])
#     print("アライグマ",A[i:N])
    x = sum(A[0:i])
    y = sum(A[i:N])
    ans = min(abs(x - y), ans)
print(ans)

### FIXED CODE ###

N = int(input())
A = [int(i) for i in input().split()]

A_sum = sum(A)
check = 0
ans = 10 ** 18
for i in range(N-1):
    check += A[i]
    ans = min(abs(check - (A_sum - check)), ans)
print(ans)
### BUGGY CODE ###

A,B,C = map(int,input().split())
count = 0
for i in range(C):
    if B > 0:
        B -= 1
        count += 2
    elif A > 0:
        A -= 1
        count += 1
    else:
        if C > 0:
            count += 1
        break
for i in range(B):
    count += 1
print(count)

### FIXED CODE ###

A,B,C = map(int,input().split())
if C > (A + B):
    count = A + B + B + 1
elif C == (A + B):
    count = A + B + B
else:
    count = C + B
print(count)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**6)

n = int(input())
e = [[] for _ in range(n)]

for i in range(n-1):
    a, b = [int(item) for item in input().split()]
    e[a-1].append(b-1)
    e[b-1].append(a-1)

shortest = []
def get_path(start, end, par, path):
    global shortest
    if end in e[start]:
        shortest = path + [end]
        return True
    for item in e[start]:
        if item != par:
             if get_path(item, end, start, path + [item]):
                 return True

def tree_count(start, par, a, b):
    count = 0
    for item in e[start]:
        if start == a and item == b:
            continue
        if start == b and item == a:
            continue
        if item != par:
            count += 1
            count += tree_count(item, start, a, b)
    return count

get_path(0, n-1, -1, [0])
cut_l = (len(shortest)-1) // 2
p = tree_count(0, -1, shortest[cut_l], shortest[cut_l+1])
q = n - p - 2 
if p > q:
    print("Fennec")
else:
    print("Snuke")

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)

n = int(input())
e = [[] for _ in range(n)]

for i in range(n-1):
    a, b = [int(item) for item in input().split()]
    e[a-1].append(b-1)
    e[b-1].append(a-1)

shortest = []
def get_path(start, end, par):
    if end in e[start]:
        shortest.append(end)
        return True
    for item in e[start]:
        if item != par:
             if get_path(item, end, start):
                 shortest.append(item)
                 return True

def tree_count(start, par, a, b):
    count = 0
    for item in e[start]:
        if start == a and item == b:
            continue
        if start == b and item == a:
            continue
        if item != par:
            count += 1
            count += tree_count(item, start, a, b)
    return count

get_path(0, n-1, -1)
shortest.append(0)
shortest = shortest[::-1]
cut_l = (len(shortest)-1) // 2
p = tree_count(0, -1, shortest[cut_l], shortest[cut_l+1])
q = n - p - 2 
if p > q:
    print("Fennec")
else:
    print("Snuke")