Harryxun/stf_run huggingface dataset:
from collections import deque
que=deque([range(1,10)])
k=int(input())
count=0
while count!=k:
  a=que.popleft
  count+=1
  if a%10 == 1:
    que.append([10*a+1,10*a+2])
  elif a%10==9:
    que.append([10*a+8,10*a+9])
  else:
    b=a*10+(a%10)-1
    que.append([b,b+1,b+2])
print(count)


### FIXED CODE ###

from collections import deque
que=deque([i for i in range(1,10)])
k=int(input())
count=0
while count!=k:
  a=que.popleft()
  count+=1
  if a%10==9:
    que.extend([10*a+8,10*a+9])
  elif a%10==0:
    que.extend([10*a,10*a+1])
  else:
    b=a*10+(a%10)-1
    que.extend([b,b+1,b+2])
print(a)
a = input("半径")
print(a*a)

### FIXED CODE ###

a = int(input())
a *= a
print(a)
a=int(intput())
b=int(intput())
print(6-a-b)

### FIXED CODE ###

print(6-int(input())-int(input()))
X, Y = map(int, input().split())
MOD = 10 ** 9 + 7


if (X + Y) % 3 != 0:
    print(0)
    exit()


X, Y = min(X, Y), max(X, Y)
ALL_MOVE = (X + Y) // 3

for m1 in range(ALL_MOVE):
    m2 = ALL_MOVE - m1

    if (m1 * 2 + m2 == X) and (m1 + m2 * 2 == Y):
        move_1_cnt = m1
        move_2_cnt = m2
        break


factorial = [1]
inverse = [1]
for i in range(1, ALL_MOVE + 2):
    factorial.append(factorial[-1] * i % MOD)
    inverse.append(pow(factorial[-1], MOD - 2, MOD))


# 組み合わせ計算
def nCr(n, r):
    if n < r or r < 0:
        return 0
    elif r == 0:
        return 1
    return factorial[n] * inverse[r] * inverse[n - r] % MOD


print(nCr(ALL_MOVE, move_1_cnt) % MOD)


### FIXED CODE ###

X, Y = map(int, input().split())
MOD = 10 ** 9 + 7


if (X + Y) % 3 != 0:
    print(0)
    exit()


X, Y = min(X, Y), max(X, Y)
ALL_MOVE = (X + Y) // 3
for m1 in range(ALL_MOVE):
    m2 = ALL_MOVE - m1

    if (m1 * 2 + m2 == X) and (m1 + m2 * 2 == Y):
        move_1_cnt = m1
        move_2_cnt = m2
        break
else:
    print(0)
    exit()


factorial = [1]
inverse = [1]
for i in range(1, ALL_MOVE + 2):
    factorial.append(factorial[-1] * i % MOD)
    inverse.append(pow(factorial[-1], MOD - 2, MOD))


# 組み合わせ計算
def nCr(n, r):
    if n < r or r < 0:
        return 0
    elif r == 0:
        return 1
    return factorial[n] * inverse[r] * inverse[n - r] % MOD


print(nCr(ALL_MOVE, move_1_cnt) % MOD)
a,b = input().split()
a = int(a)
b = Decimal(b)

print(int(a*b))

### FIXED CODE ###

a,b = input().split()

from decimal import Decimal

a = int(a)
b = Decimal(b)

print(int(a*b))
n = int(input())
c = 0
n1 = 0
n1 += n
for i in range(1,12):
    a = n1 - 26**(i)
    c += 1
    if a <= 0:
        break
    n1 = n1 - 26**(i)
a = ""
for i in range(c):
    if n // 26**(c-i-1) >= 26:
        alpha = 26
        n = n - 26**(c-i)
    else:
        alpha = n // 26**(c-i-1)
        n = n % 26**(c-i-1)
    a += chr(96 + alpha)
print(a)

### FIXED CODE ###

a = input()
if str.upper(a) == a:
    print("A")
else:
    print("a")
n=int(input())
h=[int(x) for x in input().split()]

ans_list=[]

def A(i,n,h,ans_list):
    ans=0
    if n==1:
        ans_list.append(0)
        
    for j in range(i,n-1):
        if h[j]>=h[j+1]:
            ans+=1
            if j==n-2:
                ans_list.append(ans)
                break
        else:
            ans_list.append(ans)
            A(j+1,n,h,ans_list)
            break
        
A(0,n,h,ans_list)
print(max(ans_list))


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)
n=int(input())
h=[int(x) for x in input().split()]

ans_list=[]

def A(i,n,h,ans_list):
    ans=0
    for j in range(i,n-1):
        if h[j]>=h[j+1]:
            ans+=1
            if j==n-2:
                ans_list.append(ans)
                break
        else:
            ans_list.append(ans)
            A(j+1,n,h,ans_list)
            break
        
if n==1:
    print(0)
else:
    A(0,n,h,ans_list)
    print(max(ans_list))
str1 = input()
str2 = input()

if str1 == str2:
    print('Yes')

for i in range(len(str1) - 1):

    str1 = str1[-1] + str1[:-1]

    if str1 == str2:
        print('Yes')
        break

if str1 != str2:
    print('No')

### FIXED CODE ###

tasks = input()

tasks = [int(t) for t in tasks.split()]

# 0, 1, 2
cost0 = abs(tasks[1] - tasks[0]) + abs(tasks[2] - tasks[1])

# 0, 2, 1
cost1 = abs(tasks[2] - tasks[0]) + abs(tasks[2] - tasks[1])

# 1, 0, 2
cost2 = abs(tasks[1] - tasks[0]) + abs(tasks[2] - tasks[0])

# 1, 2, 0
cost3 = abs(tasks[1] - tasks[2]) + abs(tasks[2] - tasks[0])

# 2, 0, 1
cost4 = abs(tasks[2] - tasks[0]) + abs(tasks[0] - tasks[1])

# 2, 1, 0
cost5 = abs(tasks[2] - tasks[1]) + abs(tasks[0] - tasks[1])

min_cost = min([cost0, cost1, cost2, cost3, cost4, cost5])

print(min_cost)
n=raw_input()
A=map(int,raw_input().split())
q=raw_input()
m=map(int,raw_input().split())

def solve(c, m):
  if m == 0:
    return 1
  if c >= n or sum(A)<m:
    return 0
  res = solve(c + 1, m) or solve(c + 1, m - A[c])
  return res

for i range(0,q):
  if solve(0,m[i]):
    print "yes"
  else:
    print "no"

### FIXED CODE ###

n=int(raw_input())
A=map(int, raw_input().split())
q=int(raw_input())
m=map(int, raw_input().split())

def solve(j, m):
  if m == 0:
    return 1
  if j >= n or m > sum(A):
    return 0
  res = solve(j + 1, m) or solve(j + 1, m - A[j])
  return res

for i in range(0,q):
  if solve(0,m[i]):
    print "yes"
  else:
    print "no"
h = int(input())
a1,a2,a3 = h.split()
result = a1+a2+a3
if result>22 or result == 22:
  print("bust")
else:
  print("win")


### FIXED CODE ###

inp = input()
inpLi = inp.split()
A1 = int(inpLi[0])
A2 = int(inpLi[1])
A3 = int(inpLi[2])

if (A1+A2+A3) >= 22:
  print("bust")
else:
  print("win")
a = [int(input()) for i in range(3)]
if a[0] == 1:
	print("Hello World")
else:
	print(a[1]+a[2])

### FIXED CODE ###

a = int(input())
if a == 1:
  print("Hello World")
else:
  b = int(input())
  c = int(input())
  print(b + c)
s=list(map(str,input().split()))
if s[2]==s[3] and s[4]==s[5]:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

s=list(input())
if s[2]==s[3] and s[4]==s[5]:
    print('Yes')
else:
    print('No')
i = map(int, input.split())

if i[0] == i[1]:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

i,j = map(int, input().split())

if i == j:
  print("Yes")
else:
  print("No")
from collections import Counter
n=int(input())
ab=list(map(int,input().split()))
a=[]
for i in Counter(ab):
  if Counter(ab)[i]==1:
    a.append(i)
ans=set([])
a.sort()
ans_count=0
N=10**9+1
if len(a)==0:
  print(0)
else:
  for i in range(n):
    if not a[i] in ans:
      N=a[i]
      count=1
      ans.add(N)
      ans_count+=1
      while N*count<10**6+1:
        count+=1
        ans.add(N*count)
  print(ans_count)

### FIXED CODE ###

from collections import Counter
n = int(input())
a = [int(v) for v in input().split()]
 
M = max(a)
d = [1 for i in range(M+1)]
for v in sorted(a):
    for j in range(2*v, M+1, v):
        d[j] = 0
ans = 0
c = Counter(a)
for i in a:
    if c[i]==1:
      ans += d[i]
print(ans)
S = input()
 
arr = [0 if s == "W" else 1 for s in S]
sorted_arr = sorted(arr)
 
state = [arr[i] * i for i in range(len(S))]
final_state = [sorted_arr[i] * i for i in range(len(S))]
 
print(final_state - state)
S = input()

arr = [0 if s == "W" else 1 for s in S]

state = sum([arr[i] * i for i in range(len(S))])
final_state = sum([sorted(arr)[i] * i for i in range(len(S))])

print(final_state - state)

### FIXED CODE ###

S = input()
 
arr = [0 if s == "W" else 1 for s in S]
sorted_arr = sorted(arr)
  
state = sum([arr[i] * i for i in range(len(S))])
final_state = sum([sorted_arr[i] * i for i in range(len(S))])
 
print(final_state - state)
import copy
def main():
    n,m = map(int,input().split())
    ans = [0 for i in range(n)]
    for i in range(m):
        s,c = map(int,input().split())
        if ans[s-1] !=0:
            ans[s-1] = min(ans[s-1],c)
        else:
            ans[s-1] = c
    ans = ans[0]*100 + ans[1]*10 + ans[2]
    cnt = 1
    copy_ans = copy.deepcopy(ans)
    while copy_ans > 10:
        copy_ans /= 10
        cnt += 1
    if cnt==n:
        print(ans)
    else:
        print('-1')

main()

### FIXED CODE ###

import copy
def main():
    n,m = map(int,input().split())
    sc = []
    for i in range(m):
        s,c = map(int,input().split())
        sc.append([s,str(c)])
    if n==1:
        for i in range(10):
            flag = True
            tmp = str(i)
            tmp = list(tmp)
            tmp = ['0' for j in range(n-len(tmp))] + tmp
            for j in range(m):
                if tmp[sc[j][0]-1] !=sc[j][1]:
                    flag = False
            if flag:
                print(i)
                exit()
            
    else:        
        for i in range(10**(n-1),10**n):
            flag = True
            tmp = str(i)
            tmp = list(tmp)
            tmp = ['0' for j in range(n-len(tmp))] + tmp
            
            for j in range(m):
                if tmp[sc[j][0]-1] !=sc[j][1]:
                    flag = False
            if flag:
                print(i)
                exit()
    print('-1')
main()
n=int(input())
s=list(input())
k=int(input())
for i in range(n):
    if s[i]!=s[k]:
        s[i]='*'
print(' '.join(s))

### FIXED CODE ###

n=int(input())
s=list(input())
k=int(input())
p=s[k-1]

for i in range(n):
    if s[i]!=p:
        s[i]='*'
print(''.join(s))
n = int(input())
for i in range(n, 1000):
  if i % 111 = 0:
    print(i)
    break

### FIXED CODE ###

n = int(input())
for i in range(n, 1000):
  if i % 111 == 0:
    print(i)
    exit()
#!/usr/bin/env python

def main():
    N, M = map(int, input().split())
    S = [list(map(int, input().split() for _ in range(M)))]
    P = list(map(int, input().split()))
    ans = 0

    # all possible switch patterns
    for i in range(2 ** N):
        light_on = 0
        # all switch conditions
        for j in range(M):
            switch_on = 0
            # all connected switch
            for k in S[j][1:]:
                # convert integer to binary
                if (i >> k-1) & 1:
                    switch_on += 1
            if switch_on %2 == P[j]:
                light_on += 1
        if light_on == M:
            ans += 1

    return ans

if __name__ == '__main__':
    print(main())



### FIXED CODE ###

#!/usr/bin/env python

def main():
    N, M = map(int, input().split())
    S = [list(map(int, input().split())) for _ in range(M)]
    P = list(map(int, input().split()))
    ans = 0

    # all possible switch patterns
    for i in range(2 ** N):
        light_on = 0
        # all switch conditions
        for j in range(M):
            switch_on = 0
            # all connected switch
            for k in S[j][1:]:
                # convert integer to binary
                if (i >> k-1) & 1:
                    switch_on += 1
            if switch_on %2 == P[j]:
                light_on += 1
        if light_on == M:
            ans += 1

    return ans

if __name__ == '__main__':
    print(main())
if(a.isupper()==True):
        print("A")
    else:
        print("a")

### FIXED CODE ###

a=input()
if(a.isupper()):
    print("A")
else:
    print("a")
import sys
from collection import defaultdict
import math

def calc(num):
    if num<=1:
        return 1
    else:
        num_sqrt=math.floor(math.sqrt(num))
        prime_list=make_prime_list_2(num_sqrt)

        dict_counter=defaultdict(int)
        for prime in prime_list:
            while num % prime==0:
                dict_counter[prime]+=1
                num //=prime
        if num !=1:
            dict_counter[num]+=1

        dict_counter=dict(dict_counter)

        return dict_counter
def main():
    num=input()
    eight_counter=[]
    for i in range(num):
        if calc(num)==8:
            eight_counter.append(num)
        else:
            pass
    print(len(eight_counter))

main()

### FIXED CODE ###

def calculate_num_of_divisor(N):
    yakusuu = []
    for i in range(1, N+1):
        if N % i == 0:
            yakusuu.append(i)
    return len(yakusuu)

N = int(input())
count = []
for i in range(N+1):
    if i % 2 == 1 and calculate_num_of_divisor(i) == 8:
        count.append(i)
print(len(count))
a,b,c=map(int, input().split())
ans = a+b+c
m = max(a, max(b,c))
ans += (pow(2,K)-1) * m
print(ans)


### FIXED CODE ###

a,b,c=map(int, input().split())
K=int(input())
ans = a+b+c
m = max(a, max(b,c))
ans += (pow(2,K)-1) * m
print(ans)
in_a = [int(x) for x in input().split(' ')]
in_b = [int(x) for x in input().split(' ')]
t = int(input())

result = False

p_a = in_a[0]
p_b = in_b[0]
m_a = in_a[1]
m_b = in_b[1]

def to_right():
  for i in range(t):
    if m_a <= m_b:
      break
    p_a += m_a
    p_b += m_b

def to_left():
  for i in range(t):
    if m_a <= m_b:
      break
    p_a -= m_a
    p_b -= m_b

if p_a < p_b:
  to_right()
else:
  to_left()

if result:
  print('YES')
else:
  print('NO')

### FIXED CODE ###

in_a = [int(x) for x in input().split(' ')]
in_b = [int(x) for x in input().split(' ')]
t = int(input())

result = False

p_a = in_a[0]
p_b = in_b[0]
m_a = in_a[1]
m_b = in_b[1]
end_p_a = m_a*t
end_p_b = m_b*t

diff_s = abs(p_a-p_b)

if end_p_a-end_p_b>=diff_s:
  print('YES')
else:
  print('NO')
x = input()

y = x**3

print (int(y)

### FIXED CODE ###

x = int(input())
print(x ** 3)
s = input()
t = input()

s_2 = "".join(sorted(s))
t_2 = "".join(sorted(t,reverse = True)

if(s_2 < t_2):
    print("YES")
else:
    print("NO")

### FIXED CODE ###

s = input()
t = input()

s_2 = "".join(sorted(s))
t_2 = "".join(sorted(t,reverse = True))

if s_2 < t_2 :
    print("Yes")
else:
    print("No")
n = int(input())
l = []
for i in range(1,n+1):
    for j in range(2,i):
        if i**j <= n:
            l.append(i**j)
print(max(l))

### FIXED CODE ###

n = int(input())
l = []
for i in range(1,n+1):
    for j in range(2,100):
        if i**j <= n:
            l.append(i**j)
print(max(l))
from sys import stdin

[H, N] = [int(x) for x in stdin.readline().rstrip().split()]
As = []
Bs=[]
for i in range(N):
    [A, B] = [int(x) for x in stdin.readline().rstrip().split()]
    As.append(A)
    Bs.append(B)

dp_map = []
for i in range(N+1):
    temp_arr = [False for _ in range(H+1)]
    dp_map.append(temp_arr)

def DP(i, j):
    if j<=0:
        return 0
    if dp_map[i][j]!=False:
        return dp_map[i][j]
    
    if i==1:
        dp_map[i][j] = DP(i,j-As[i-1])+Bs[i-1]
        return dp_map[i][j]

    dp_map[i][j] = min(DP(i-1,j),DP(i,j-As[i-1])+Bs[i-1])
    return dp_map[i][j]

print(DP(N,H))

### FIXED CODE ###

from sys import stdin
from sys import  setrecursionlimit
setrecursionlimit(10000)

[H, N] = [int(x) for x in stdin.readline().rstrip().split()]
As = []
Bs=[]
for i in range(N):
    [A, B] = [int(x) for x in stdin.readline().rstrip().split()]
    As.append(A)
    Bs.append(B)

INF = 10**10
dp_map = [[INF]*(H+1) for _ in range(N+1)]

#dp_map[i][j]: i番目の魔法までを使って、最低でもjのダメージを与える時に必要なMP
dp_map[0][0]  = 0
for i in range(N):
    for j in range(H+1):
        if j<As[i]:
            dp_map[i+1][j] = min(dp_map[i+1][0]+Bs[i],dp_map[i][j])
        else:
            dp_map[i+1][j] = min(dp_map[i+1][j-As[i]]+Bs[i] ,dp_map[i][j])

print(dp_map[N][H])
a,b=map(int,input().split())
if a==3 and b==1 :
  print(2)
elif a==1 and b==2 :
  print(3)
elif a==2 and b==3 :
  print(1)

### FIXED CODE ###

a=int(input())
b=int(input())
if a==3 and b==1 :
  print(2)
elif a==1 and b==2 :
  print(3)
elif a==2 and b==3 :
  print(1)
elif a==3 and b==2 :
  print(1)
elif a==1 and b==3 :
  print(2)
elif a==2 and b==1 :
  print(3)
from collections import deque
N,K=map(int,input().split())
S=input()
C=[]
prv=1
cnt=0
for c in S:
    if prv != c:
        C.append(cnt)
        cnt=1
    else:
        cnt+=1
    prv=c
if cnt>0:
    C.append(cnt)
if prv==0:
    C.append(0)
M=len(C)//2
que=deque([C[0]])
res=ans=C[0]
for i in range(M):
    if len(que)==2*K+1:
        res-=que.popleft()+que.popleft()
    que.append(C[2*i+1])
    que.append(C[2*i+2])
    res+=C[2*i+1]+C[2*i+2]
    ans=max(res,ans)
print(ans)


### FIXED CODE ###

N,K=map(int,input().split())
S=input()
C=[]
flag=False
count=0
prv=S[0]
if S[0]!="1":
    C.append(0)
"""
for i in range(N):
    if prv!=S[i]:
        C.append(count)
        count=1
    else:
        count+=1
    prv=S[i]
if count>0:
    C.append(count)
"""
tmp=0
for i in range(len(S)):
    if i<tmp:
        continue
    j=tmp
    while(S[j]==S[i]):
        j+=1
        if j==len(S):
            break
    C.append(j-i)
    tmp=j
if S[-1]=="0":
    C.append(0)
if len(C)==1:
    print(sum(C))
    exit()
ans=0
#print(C)
sums=[0]*(len(C))
sums.append(0)
for i in range(len(C)):
    sums[i+1]=sums[i]+C[i]
#print(sums)
for left in range(0,len(sums),2):
    right=left+2*K+1
    if right>=len(sums):
        right=int(len(sums))-1
    ans=max(ans,sums[right]-sums[left])
print(ans)
N = int(input())
A = int(input())
B = int(input())

if N > 1:
  print(A+B)
else:
  print("Hello World")

### FIXED CODE ###

N = int(input())
if N ==1:
  print("Hello World")
elif N == 2:
  A = int(input())
  B = int(input())
  print(A+B)
import math
import sys
 
 
def Knight():
    def check(d):
        if not ((d[0] % 3 == 0 and d[1] % 3 == 0) or (d[0] % 3 == 1 and d[1] % 3 == 2) or (d[0] % 3 == 2 and d[1] % 3 == 1)):
            print(0)
            sys.exit()
    d = list(map(int, input().split()))
    check(d)
 
    x = d[0]
    y = d[1]
    diff = x - y if x > y else y - x  # aとbの回数の差
    d2 = [x - diff, y - diff * 2] if x < y else [x - diff * 2, y - diff]
    r = d2[0] // 3
 
    def cmb(n, r, mod):
        r = min(r, n-r)
        return g1[n] * g2[r] * g2[n-r] % mod
 
    mod = 10**9+7  # 出力の制限
    N = x if x > y else y
    g1 = [1, 1]  # 元テーブル
    g2 = [1, 1]  # 逆元テーブル
    inverse = [0, 1]  # 逆元テーブル計算用テーブル
 
    for i in range(2, N + 1):
        g1.append((g1[-1] * i) % mod)
        inverse.append((-inverse[mod % i] * (mod//i)) % mod)
        g2.append((g2[-1] * inverse[-1]) % mod)
 
    a = cmb(r*2+diff, r, mod)
 
    print(a)
 
 
Knight()

### FIXED CODE ###

def getCircleArea(r):
    return r * r


print(getCircleArea(int(input())))
a=input()
b=a/2

### FIXED CODE ###

a=int(input())
b=int(a/2)
if b*2==a:
  print(a)
else:
  print(a*2)
N =int(input())
A = map(int, input().split())
 
for a in A:
    ans *= a
    if ans > 10**18:
        print(-1)
        exit()
print(ans)

### FIXED CODE ###

n = int(input())
a = [i for i in map(int, input().split())]
 
if a.count(0) != 0:
  print(0)
else:
  result = 1
  for i in range(n):
    result *= a[i]
    if result > (10**18):
      print(-1)
      break
    else:
      continue
  else:
    print(result)
sent=""
while True:
    ex=input().lower()
    sent+=ex
    if ex.endswith(".")==True:
        break
for i in range(ord("a"),ord("z")+1):
    x=sent.count(chr(i))
    print(chr(i),":",x)

### FIXED CODE ###

sent=""
while True:
    try:
        ex=input().lower()
        sent+=ex
    except:
        break
for i in range(ord("a"),ord("z")+1):
    x=sent.count(chr(i))
    print(chr(i),":",x)
def gcd(x,y):
    x,y = max(x,y),min(x,y)
    while(y>0):
        x,y = y,x%y
    return(x)
    
def lcm(a,b):
    return(int(a*b/gcd(a,b)))

n = int(input())
a = list(map(int,input().split()))
least_common_multiple = 1
for i in range(n):
    least_common_multiple = lcm(least_common_multiple,a[i])
ans = 0
for i in range(n):
    ans += (least_common_multiple-1)%a[i]
print(ans)

### FIXED CODE ###

import numpy as np
n = int(input())
a = np.array(list(map(int,input().split())))-1
print(a.sum())
import sys
mod=10**9+7
x,y=map(int,input().split())

a=(-x+2*y)//3
b=(2*x-y)//3

if a<0 or b<0:
  print(0)
  sys.exit()
  
f=[1]
for i in range(1,a+b+1):
    f.append(f[-1]*i%mod)

if a+2*b==x and 2*a+b==y:
    print(f[a+b]*pow(f[a]*f[b],mod-2,mod)%mod)
else:
    print(0)

### FIXED CODE ###

r=int(input())

print(r**2)
#include <bits/stdc++.h>
 using namespace std;

 int main() {
 	double ans;
 	double T,X;
 	cin >> T>>X;
 	ans = T/(double(X));
 	cout << ans << endl;
 }

### FIXED CODE ###

T,X= map(float,input().split( ))

ans = T/X
print(ans)
a, b = list(map(int, input().split()))
if (a + b == 15):
  print("+")
else if (a * b == 15):
  print("*")
else:
  print("x")

### FIXED CODE ###

a, b = list(map(int, input().split()))
if (a + b == 15):
  print("+")
elif (a * b == 15):
  print("*")
else:
  print("x")
def f(A,B,n) :
    judge=B-A
    if judge % 2==0 :
        n+=judge//2
        return(n)

    else :
        if abs(A-1) < abs(N-B) :
            if A>1 :
                A-=A-1
            else:
                pass
            B-=A-1
            n+=A-1
            return f(A,B,n)
        else :
            if B<N :
                B+=N-1
            else :
                pass
            A+=N-1
            n+=N-1
            return f(A,B,n)

N,A,B=map(int,input().split())
print(f(A,B,0))



### FIXED CODE ###

# AtCoder Grand Contest 041
# A - Table Tennis Training

def f(A,B,n) :
    judge=B-A

    if judge%2==0 :
        n+=judge//2
        return(n)

    else :
        if abs(A-1) < abs(N-B) :
            if A==1 :
                A=A
                B-=1
                n+=1
            else:
                B-=A-1
                n+=A-1
                A-=A-1
            return f(A,B,n)
        else :
            if B==N :
                B=B
                A+=1
                n+=1
            else :
                A+=abs(N-B)
                n+=abs(N-B)
                B+=abs(N-B)
            return f(A,B,n)

N,A,B=map(int,input().split())
print(f(A,B,0))
n = int(input())
print n//2

### FIXED CODE ###

import math
n = int(input())
print(math.ceil(n/2))
import sys

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

coord = [a, b, c, d, e]
for i in range(len(coord)):
    for j in range(len(coord)):
        if abs(coord[i] - coord[j]) > k :
            print(":(")
            sys.exit(1)
print("Yay!")

### FIXED CODE ###

import sys

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

coord = [a, b, c, d, e]
flag = False
for i in range(len(coord)):
    for j in range(len(coord)):
        dis = abs(coord[i] - coord[j])
        if dis > k :
            flag = True
if flag == True :
    print(":(")
else :
    print("Yay!")
n = int(input())
test = []
for i in range(n):
    test.append(input())
print('AC x ' + str(test.count('AC')))
print('NA x ' + str(test.count('NA')))
print('TLE x ' + str(test.count('TLE')))
print('RE x ' + str(test.count('RE')))

### FIXED CODE ###

n = int(input())
if n%1000 == 0:
    print(0)
else:
    print(1000 - n % 1000)
n,m = map(int, input().split())
py = []
for i in rante(m):
  a,b = map(int, input.split())
  py.append([a,b,i])
py.sort()
p = 1
y = 1
for i in range(m):
  if py[i][0] == p:
    py[i][1] = y
    y += 1
  else:
    py[i][1] = 1
    y = 1
    p = py[i][0]
py.sort(key=lambda x:x[2])
for p,y,i in py:
  print("{06}{06}".format(p,y))



### FIXED CODE ###

n,m = map(int, input().split())
py = []
for i in range(m):
  a,b = map(int, input().split())
  py.append([a,b,i])
py.sort()
p = py[0][0]
y = 1
for i in range(m):
  if py[i][0] == p:
    py[i][1] = y
    y += 1
  else:
    py[i][1] = 1
    y = 2
    p = py[i][0]
py = sorted(py, key=lambda x:x[2])
for p,y,i in py:
  print("{:0=6}{:0=6}".format(p,y))
if a + b + 2 * math.sqrt(a*b) < c:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

import math

a, b, c = map(int, input().split(" "))

d = c - a - b

if d > 0 and d**2 > 4*a*b:
    print('Yes')
else:
    print('No')
def scanf(scanstr,data_format):
    scanstr=scanstr.split(" ")
    if(type(data_format) is not list):
        print("data_format error")
    if(len(scanstr)!=len(data_format)):
        print("Error")
        return -1
    j=0
    for kata in data_format:
        if(kata=="str"):
            scanstr[j]=str(scanstr[j])
        if(kata=="int"):
            scanstr[j]=int(scanstr[j])
        j=j+1
    return scanstr
data=mylib.scanf(input(),["int","int"])
if data[0]!=1 and data[1]!=1:
    print(str(round(float(data[0]*data[1])/2.0+0.1)))
else:
    print(1)

### FIXED CODE ###

data=(1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51)
print(str(data[int(input())-1]))