Harryxun/stf_run huggingface dataset:
while True:
    c = input()
    c = [int(c[0] + c[1]),int(c[2] + c[3])]
    g = ""
    if c[0] > 12 and c[1] < 13 and c[1] != 0:
        g = "YYMM"
    if c[0] < 13 and c[1] > 12 and c[0] != 0:
        g = "MMYY"
    if c[0] < 13 and c[1] < 13:
        g = "AMBIGUOUS"
    if c[0] < 1 or c[1] < 1 or c[1] > 12 and c[0] > 12:
        g = "NA"
    print(g)

### FIXED CODE ###

s=(input())
s1=int(s[:2])
s2=int(s[2:])
 
if 1<= s1 <=12 and 1<= s2 <= 12:
    print("AMBIGUOUS")
 
elif 0<= s1 <=99 and 1<= s2 <= 12:
    print("YYMM")
 
elif 1<= s1 <=12 and 0<= s2 <= 99:
    print("MMYY")
 
else:
    print("NA")
m=int(input())
l=[list(map(int,input().split())) for i in range(m)]
ct=0;sum=0
for i in range(m):
  ct+=l[i][0]*l[i][1]
  sum+=l[i][1]
ans=sum-1
sct=str(ct)
if len(sct)>=2:
  for i in range(1,len(sct)):
    ans+=int(ct[0:i])
print(ans)

### FIXED CODE ###

m=int(input())
l=[list(map(int,input().split())) for i in range(m)]
ct=0;sum=0
for i in range(m):
  ct+=l[i][0]*l[i][1]
  sum+=l[i][1]
print(sum-1+((ct-1)//9))
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

readl= lambda: list(map(int, sys.stdin.readline().split()))
readt= lambda: tuple(map(int, sys.stdin.readline().split()))
read = lambda: sys.stdin.readline().rstrip()
readi = lambda: int(read())
readmi = lambda: map(int, sys.stdin.readline().split())
readms = lambda: map(str, sys.stdin.readline().split())

n, m = readmi()
a = readl()
a.sort()
d = defaultdict(int)
for i in a:
    if d[i]:
        d[i] += 1
    else:
        d[i] = 1

for i in range(m):
    x, y = map(int, input().split())
    for j in sorted(d):
        if y > j:
            w = d[j]
            ww = x
            d[j] -= ww
            x -= w
            d[y] += min(ww, w)
            if d[j] <= 0:
                del d[j]
            if x <= 0:
                break
        else:
            break
count = 0
for i in d:
    count += max(int(d[i]) * int(i),0)
print(count)

### FIXED CODE ###

# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

n, m = map(int, input().split())
a = [0] * (n + 2)
r = defaultdict(int)
for i in range(m):
    x,y = map(int,input().split())
    a[x - 1] += 1
    a[y] += -1

for i in range(n + 1):
    a[i + 1] += a[i]
count = 0
flg = True
for i in range(n):
    if a[i] >= m:
        count += 1
print(count)
n, k = [int(i) for i in input().split()]

if n > k:
    tmp = k 
    while not (n - tmp) % k == 0:
        tmp -= 1
    n = tmp
    
while tmp >= n:
    tmp = n
    n = abs(n - k)
    if tmp < n:
        break
print(tmp)

### FIXED CODE ###

n, k = [int(i) for i in input().split()]
print(min(n % k, k - n % k))
mport math
a,b,h,m = map(int, input().split())
if h > 12:
    h_c = h-12
p_d = 6*(abs(h*5 - m))
if p_d >= 180:
    p_d2 = 360 - p_d 
    d_2 = a**2 + b**2 - 2*a*b*math.cos(math.radians(p_d2))
    print(math.sqrt(d_2))
else:
    d_2 = a**2 + b**2 - 2*a*b*math.cos(math.radians(p_d))
    print(math.sqrt(d_2))

### FIXED CODE ###

import math
a,b,h,m = map(int, input().split())
if h > 12:
    h_c = h-12
else:
    h_c = h
p_d = 6*(abs((h_c)*5+5*(m/60) - m)) #時針も分針の位置で一変わるんだった・・・
if p_d >= 180:
    p_d2 = 360 - p_d 
    d_2 = a**2 + b**2 - 2*a*b*math.cos(math.radians(p_d2))
    print(math.sqrt(d_2))
else:
    d_2 = a**2 + b**2 - 2*a*b*math.cos(math.radians(p_d))
    print(math.sqrt(d_2))
n = int(input)

print(round(n/2))

### FIXED CODE ###

n = int(input())
 
if n % 2 == 1:
  print(int((n+1)/2))
else:
  print(int(n/2))
N = int(input())
MAXN = 1005
MAXV = MAXN*(MAXN-1)//2
to = [[]for _ in range(MAXV)]
id = [[0]*MAXN for _ in range(MAXN)]


def toId(i, j):
    return id[min(i, j)][max(i, j)]


visited = [False] * MAXV
calculated = [False] * MAXV
dp = [0] * MAXV


def dfs(v):
    if visited[v]:
        if calculated[v]:
            return -1
        else:
            return dp[v]
    visited[v] = True
    dp[v] = 1
    for nv in to[v]:
        res = dfs(nv)
        if res == -1:
            return -1
        dp[v] = max(dp[v], dfs(nv) + 1)
    calculated[v] = True
    return dp[v]


a = [list(map(int, input().split())) for _ in range(N)]
for i in range(N):
    for j in range(N-1):
        a[i][j] -= 1
vid = 0
for i in range(N):
    for j in range(N):
        if i < j:
            id[i][j] = vid
            vid += 1

# プレイヤーiの試合の依存関係の情報をグラフ化
for i in range(N):
    for j in range(N-1):
        a[i][j] = toId(i, a[i][j])
    for j in range(N-2):
        to[a[i][j+1]].append(a[i][j])
ans = 0
print(vid)

for i in range(N):
    print(a[i])
for i in range(vid):
    res = dfs(i)
    if res == -1:
        print(-1)
        exit()
    ans = max(ans, res)
print(vid)
print(ans)


### FIXED CODE ###

N = int(input())
MAXN = 1005
MAXV = MAXN*(MAXN-1)//2
to = [[]for _ in range(MAXV)]
id = [[0]*MAXN for _ in range(MAXN)]


def toId(i, j):
    return id[min(i, j)][max(i, j)]


visited = [False] * MAXV
calculated = [False] * MAXV
dp = [0] * MAXV


def dfs(v):
    if visited[v]:
        if not calculated[v]:
            return -1
        return dp[v]
    visited[v] = True
    dp[v] = 1
    for nv in to[v]:
        res = dfs(nv)
        if res == -1:
            return -1
        dp[v] = max(dp[v], res + 1)
    calculated[v] = True
    return dp[v]


a = [list(map(int, input().split())) for _ in range(N)]
for i in range(N):
    for j in range(N-1):
        a[i][j] -= 1
vid = 0
for i in range(N):
    for j in range(N):
        if i < j:
            id[i][j] = vid
            vid += 1

# プレイヤーiの試合の依存関係の情報をグラフ化
for i in range(N):
    for j in range(N-1):
        a[i][j] = toId(i, a[i][j])
    for j in range(N-2):
        to[a[i][j+1]].append(a[i][j])
ans = 0

for i in range(vid):
    res = dfs(i)
    if res == -1:
        print(-1)
        exit()
    ans = max(ans, res)
print(ans)
def main():
    n, k = map(int, input().split())
    s = input()
    sub = []
    count = 1
    for i in range(1, n):
        if s[i] == s[i-1]:
            count += 1
        else:
            sub.append(count)
            count = 1
    sub.append(count)
    
    key = s[0]
    
    if key:
        if 2*k+1 >= len(sub):
            a = n
        else:
            a = sum(sub[:(2*k+1)])
            key = 0
    else:
        if 2*k >= len(sub):
            a = n
        else:
            a = sum(sub[:(2*k)])
            key = 0
    ans = a
    flag = False
    for i in range(len(sub)):
        a -= sub[i]
        if key:
            if i+2*k == len(sub)-1:
                a += sub[i+2*k]
                flag = True
            key = 0
        else:
            if i+2*k == len(sub)-1:
                a += sub[i+2*k]
                flag = True
            else:
                a += sub[i+2*k]+sub[i+1+2*k]
            if i+2*k == len(sub)-2:
                flag = True
            key = 1
            
        if a > ans:
            ans = a
        if flag:
            break
    
    print(ans)

if __name__ == "__main__":
    main()

### FIXED CODE ###

n, k = map(int, input().split())
s = input()

key = [0]
for i in range(1, n):
  if s[i] != s[i-1]:
    key.append(i)
key.append(n)

m, r = 0, len(key)-1
ans = 0
while True:
  if m == 0 and s[0] == "0":
    p = m+2*k
    if ans < key[min([p, r])] - key[m]:
      ans = key[min([p, r])] - key[m]
    m += 1
  else:
    p = m+2*k+1
    if ans < key[min([p, r])] - key[m]:
      ans = key[min([p, r])] - key[m]
    m += 2
  if p >= r:
    break

print(ans)
import math

a,b,x=map(int,input().split())

if x>=a**2*b/2:
    print(90.0-math.degrees(math.atan(a**3/(2*a**2*b-2*x))))
else:
    print(90.0-math.degrees(math.atan(2*x/(a*b**2))))


### FIXED CODE ###

import math

a,b,x=map(int,input().split())

if x==a**2*b:
    print(0.0)
elif x>a**2*b/2:
    print(90.0-math.degrees(math.atan(a**3/(2*a**2*b-2*x))))
else:
    print(90.0-math.degrees(math.atan(2*x/(a*b**2))))
nums = input().split()
print(float(num[0]) * float(num[1]))


### FIXED CODE ###

nums = input().split()
print(int(nums[0]) * int(nums[1]))
s = raw_input()
memo1 = 0
memo2 = 0
cnt = 0
for x in s:
    if x = "A":
        memo1 = cnt
    elif x = "Z":
        memo2 = cnt
    cnt += 1

print memo2 - memo1 + 1


### FIXED CODE ###

s = raw_input()
memo1 = []
memo2 = 0
cnt = 0
for x in s:
    if x == "A":
        memo1.append(cnt)
    elif x == "Z":
        memo2 = cnt
    cnt += 1

print memo2 - memo1[0] + 1
x = max(map(len,input().split(S)))
print(x)

### FIXED CODE ###

x = max(map(len,input().split("S")))
print(x)
N,K=map(int,input().split())
ls=[[] for _ in range(N)]
for i in range(K):
  d=int(input())
  A=list(map(int,input().split()))
  for j in range(d):
    ls[A[j]-1].append(i+1)
S=0
for i in range(K):
  if ls[i]==[]:
    S+=1
print(S)

### FIXED CODE ###

N,K=map(int,input().split())#N人K種類
ls=[False for _ in range(N)]
for i in range(K):
  d=int(input())
  A=list(map(int,input().split()))
  for j in range(d):
    ls[A[j]-1]=True
S=0
for i in range(N):
  if ls[i]==False:
    S+=1
print(S)
from numba import njit
import numpy as np


def main(N, P):
    d = np.zeros((N, N), dtype=np.int32)
    d = d.ravel()
    sit = np.ones_like(d)
    que = []
    count = 0
    for i in range(N*N):
        d[i] = min(i % N, (N-1-i) % N, i//N, N-1-i//N)
    for player in P:
        sit[player-1] = 0
        count += d[player-1]
        que.append(player)
        for p in que:
            for i in (1, -1, N, -N):
                if p+i < 1 or p + i > N*N:
                    continue
                if d[p-1]+sit[p-1] < d[p+i-1]:
                    d[p+i-1] = d[p-1]+sit[p-1]
                    que.append(player+i)
    print(count)


def cc_export():
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('main', 'i8,i8[:]')(main)
    cc.compile()


if __name__ == '__main__':
    import sys
    if sys.argv[-1] == 'ONLINE_JUDGE':
        cc_export()
        exit(0)
    from my_module import main
    N = int(input())
    P = list(map(int, input().split()))
    main(N, P)


### FIXED CODE ###

from numba import njit
import numpy as np

@njit
def main(N, P):
    lista = [1, -1, N, -N]
    d = np.zeros((N, N), dtype=np.int32)
    d = d.ravel()
    sit = np.ones_like(d)
    stack = np.empty_like(d)
    count = 0
    for i in range(N*N):
        d[i] = min(i % N, (N-1-i) % N, i//N, N-1-i//N)
    for player in P:
        sit[player-1] = 0
        count += d[player-1]
        stack[0] = player
        num = 0
        while num >= 0:
            p = stack[num]
            num -= 1
            a = d[p-1]+sit[p-1]
            for i in lista:
                if p+i < 1 or p + i > N*N:
                    continue
                if d[p+i-1] > a:
                    d[p+i-1] = a
                    num += 1
                    stack[num] = p+i
    print(count)

N = int(input())
P = np.array(input().split(), np.int32)

main(N, P)
N, X = map(int,input().split())
L = list(map(int,input().split()))
D = 0
count = 1
for i in L:
    D+=L
    if D<=X:
        count+=1
    else:
        break
print(count)

### FIXED CODE ###

N, X = map(int,input().split())
L = list(map(int,input().split()))
D = 0
count = 1
for i in L:
    D+=i
    if D<=X:
        count+=1
    else:
        break
print(count)
a=input()

if a="A" or "T":
    if a=="T":
        b="A"
    if a=="A":
        b="T"

if a="C" or "G":
    if a=="C":
        b="G"
    if a=="G":
        b="C"

print(b)

### FIXED CODE ###

a=input()

if a=="A" or "T":
    if a=="T":
        b="A"
    if a=="A":
        b="T"

if a=="C" or "G":
    if a=="C":
        b="G"
    if a=="G":
        b="C"

print(b)
# coding: utf-8

from copy import deepcopy

N, X, Y = map(int, input().split())

neighbor = {}
for i in range(1, X):
    neighbor[i] = [i+1]
for i in range(Y+1, N):
    neighbor[i] = [i+1]
for i in range(X+1, Y):
    neighbor[i] = [i-1, i+1]
neighbor[X] = [X+1, Y]
neighbor[Y] = [Y-1, Y+1]
neighbor[N] = [] if Y < N else [N-1]

# print(neighbor)

# neighbor = {i: [i-1, i+1] for i in range(2, N)}
# neighbor[1] = [2]
# neighbor[N] = [N-1]
# neighbor[X].append(Y)
# neighbor[Y].append(X)

appeared_st = set([])


def rec(n, dist, s, k, appeared):
    # print(appeared_st)
    if dist == k:
        if s < n and "{}.{}".format(s, n) not in appeared_st:
            appeared_st.add("{}.{}".format(s, n))

    toes = [node for node in neighbor[n] if node not in appeared]
    for to in toes:
        appeared_copy = deepcopy(appeared)
        appeared_copy.add(to)
        rec(to, dist+1, s, k, appeared_copy)

    
for k in range(1, N):
    tmp = len(appeared_st)

    for s in range(1, N+1):
        rec(s, 0, s, k, {s})

    print(len(appeared_st) - tmp)

# print(appeared_st)
# print(len(appeared_st))
            


### FIXED CODE ###

# coding: utf-8

N, X, Y = map(int, input().split())

n_k = [0] * (N+1)

for i in range(1, N):
    for j in range(i+1, N+1):
        n_k[min(abs(j-i), abs(X-i) + 1 + abs(j-Y))] += 1

for k in range(1, N):
    print(n_k[k])
from collections import Counter
from itertools import count

M = 998244353
n = int(input())
a = map(int, input().split())
x, c = next(a), Counter(a)
r = 0
if x == c[0] == 0:
  r = p = 1
  try:
    for i in count(1):
      x = c.get(i)
      r = r * pow(p, x, M) % M
      p = x; n -= p
    except:
        pass
print((r, 0)[n > 1])

### FIXED CODE ###

from collections import Counter

M = 998244353
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
if a[0] == 0 and c[0] == 1:
    r = i = 1
    while c[i]:
        r = r * pow(c[i - 1], c[i], M) % M
        n -= c[i]
        i += 1
print(r if n == 1 else 0)
N=int(input())
import sympy
a=0
for i in range(1,N):
    a+=len(sympy.divisors(i))
print(a)

### FIXED CODE ###

N=int(input())
def num_divisors_table(n):
    table = [0] * (n + 1)
    
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1
    
    return table
print(sum(num_divisors_table(N-1)))
N = int(input())
a = []
for i in range(N):
  a.append(int(input()))

for i in range(N):
  b = a[:]
  b.pop(i)
  print(max(b)

### FIXED CODE ###

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

sort = sorted(a)
m1 = sort[-1]
m2 = sort[-2]
if m1 == m2:
  for i in range(N):
    print(m1)
else:
  j = a.index(m1)
  for i in range(N):
    if i == j:
      print(m2)
    else:
      print(m1)
s=input()
print('T' if s=='A' else 'G' of s=='C' else 'A' if s=='T' else 'C')

### FIXED CODE ###

b=input()
print('A' if b=='T' else 'T' if b=='A' else 'C' if b=='G' else 'G')
N,M=map(int,input().split())
if M%N==0:
  print(M//N)
else:
  s=M//N
  if s<100000:
    ans=1
    while s!=1:
      if M%s==0:
        ans=s
        break
      s-=1
    print(ans)
  else:
    rM=M**(1/2)
    s=N
    ans=1
    while s<=rM:
      if M%s==0:
        ans=M//s
        break
      s+=1
    else:
      nya-n
    print(ans)

### FIXED CODE ###

N,M=map(int,input().split())
if M%N==0:
  print(M//N)
else:
  s=M//N
  if s<100000:
    ans=1
    while s!=1:
      if M%s==0:
        ans=s
        break
      s-=1
    print(ans)
  else:
    rM=M**(1/2)
    s=N
    ans=1
    while s<=rM:
      if M%s==0:
        ans=M//s
        break
      s+=1
    else:
      s=N
      while s!=1:
        if M%s==0:
          ans=s
          break
        s-=1
    print(ans)
from collections import deque

H, W = map(int, input().split())
grid = [list(input()) for _ in range(H)]
dot_cnt = 0
for g in grid:
    dot_cnt += g.count('.')
sy = 0
sx = 0
gy = H - 1
gx = W - 1

deq = deque()
deq.append((0, 0))
grid[0][0] = 0

y_list = [-1, 1, 0, 0]
x_list = [0, 0, -1, 1]

while deq:
    y, x = deq.popleft()
    if y == gy and x == gx:
        break
    for i in range(len(y_list)):
        dy = y + y_list[i]
        dx = x + x_list[i]
        if dy < 0 or H <= dy or dx < 0 or W <= dx:
            continue
        if grid[dy][dx] == '.':
            deq.append((dy, dx))
            grid[dy][dx] = grid[y][x] + 1
print(dot_cnt - (grid[gy][gx] + 1))


### FIXED CODE ###

from collections import deque

H, W = map(int, input().split())
grid = [list(input()) for _ in range(H)]
dot_cnt = 0
for g in grid:
    dot_cnt += g.count('.')
sy = 0
sx = 0
gy = H - 1
gx = W - 1

deq = deque()
deq.append((0, 0))
grid[0][0] = 0

y_list = [-1, 1, 0, 0]
x_list = [0, 0, -1, 1]

while deq:
    y, x = deq.popleft()
    if y == gy and x == gx:
        break
    for i in range(len(y_list)):
        dy = y + y_list[i]
        dx = x + x_list[i]
        if dy < 0 or H <= dy or dx < 0 or W <= dx:
            continue
        if grid[dy][dx] == '.':
            deq.append((dy, dx))
            grid[dy][dx] = grid[y][x] + 1
if grid[gy][gx] == '.':
    print(-1)
else:
    print(dot_cnt - (grid[gy][gx] + 1))
import sys
input = sys.stdin.readline
N = int(input())
sum = 0
li = [1] * 1000000100
for i in range(N) :
    A = int(input())
    if li[A] == 1 :
        sum +=1
        li[A] = 0
    else :
        li[A] = 1
        sum -=1
print(sum)

### FIXED CODE ###

n=int(input())
s=set()
for i in range(n):
    a=int(input())
    if a in s:
        s.remove(a)
    else:
        s.add(a)
print(len(s))
S = (int,input())
h = S // 3600
m = (S % 3600) // 60
s = (S % 60)
print('{}:{}:{}'.format(h,m,s))

### FIXED CODE ###

S = int(input())
h = S // 3600
m = (S % 3600) // 60
s = (S % 3600) % 60
print('{}:{}:{}'.format(h,m,s))
import collections
import math

url = "https://atcoder.jp//contests/abc159/tasks/abc159_d"


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


def main():
    input()
    t = list(map(int, input().split()))
    col = collections.Counter(t)
    com = {}
    al = 0
    for key in col:
        com[key] = combinations_count(col[key], 2)
        al += com[key]
    for v in t:
        c = col[v] - 1
        if c <= 1:
            c = 0
        else:
            c = com[v] - c
        tmp = (al - com[v]) + c
        print(tmp)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import collections
import math

url = "https://atcoder.jp//contests/abc159/tasks/abc159_d"


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


def main():
    input()
    t = list(map(int, input().split()))
    col = collections.Counter(t)
    com = {}
    al = 0
    for key in col:
        if col[key] < 2:
            com[key] = 0
        else:
            com[key] = combinations_count(col[key], 2)
        al += com[key]
    for v in t:
        c = col[v] - 1
        if c <= 1:
            c = 0
        else:
            c = com[v] - c
        tmp = (al - com[v]) + c
        print(tmp)


if __name__ == '__main__':
    main()
def keta(a):
    count=1
    while a>=10:
        a/=10
        count+=1
    return count

stac=[]
N=int(input())
for i in range(1,int(N/2+1)):
    if N%i==0:
        j=int(N/i)
        stac.append(max(keta(i),keta(j)))

print(min(stac))

### FIXED CODE ###

import math

def keta(a):
    count=1
    while a>=10:
        a/=10
        count+=1
    return count


N=int(input())
mi=10
for i in range(1,int(N/math.sqrt(N)+1)):
    if N%i==0:
        j=int(N/i)
        if mi>max(keta(i),keta(j)):
            mi=max(keta(i),keta(j))

print(mi)
if input() == "Sunny":
  print("Cloudy")
elif input() == "Cloudy":
  print("Rainy")
else:
  print("Sunny")

### FIXED CODE ###

S = input()

if S == "Sunny":
  print("Cloudy")
elif S == "Cloudy":
  print("Rainy")
else:
  print("Sunny")
import math
M = 256
while 1:
    N = int(raw_input())
    if N == 0: break
    H = 1
    l = map(int,raw_input().split())
    for S in range(16):
        for A in range(16):
            for C in range(16):
                R = S
                O = [0]*N
                for i in range(N):
                    R = (A*R+C)%M
                    O[i] = (l[i]+R)%M
                X = [O.count(i) for i in set(O)]
                tmp = -sum(float(x)/N*math.log(float(x)/N) for x in X)
                if tmp < H:
                    H = tmp
                    ans = [S,A,C]
    print " ".join(map(str,ans))

### FIXED CODE ###

import math,itertools as it
M = 256
while 1:
    N = int(raw_input())
    if N == 0: break
    H = 1e10
    I = map(int,raw_input().split())
    for S,A,C in it.product(range(16),repeat=3):
        R = S
        O = [0]*M
        for i in I:
            R = (A*R+C)%M
            O[(i+R)%M] += 1
        tmp = -sum(1.0*x/N*math.log(1.0*x/N,2) for x in O if x > 0)
        if tmp < H:
            H = tmp
            ans = [S,A,C]
    print " ".join(map(str,ans))
X, N = map(int, input().split())
p = list(map(int, input().split()))

if N == 0:
    ans = X
else:
    for i in range(N):
        if not X - i in p:
            ans = X - i
            break
        elif not X + i in p:
            ans = X + i
            break
        else:
            continue

print(ans)

### FIXED CODE ###

X, N = map(int, input().split())
p = list(map(int, input().split()))

ans = X
for i in range(N+1):
    if not X - i in p:
        ans = X - i
        break
    elif not X + i in p:
        ans = X + i
        break

print(ans)
x=int(input())
if x==0:
  ans=1
else x==1:
  ans=0
  
print(ans)

### FIXED CODE ###

x=int(input())
if x==0:
  ans=1
elif x==1:
  ans=0
print(ans)
N =[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]
K =int(input())
print(N[K+1])

### FIXED CODE ###

N =[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]
K =int(input())
print(N[K-1])
N = int(input())
a = list(map(int,input().split()))
b=[]
for i in range(N+1):
  b[i]=1/a[i]
  B = sum(b)
print(1/B)

### FIXED CODE ###

N = int(input())
a = list(map(int,input().split()))
b=[]
for i in range(N):
  b.append(1.0/a[i])
  B = sum(b)
print(1.0/B)
K = int(input())
S = input()

if (len(S) <= K):
    print(S)
else:
    print(S[0:K] + "...")

### FIXED CODE ###

n = input()
N = int(n)

m = N % 10

if (m == 3):
    print("bon")
elif (m == 0 or m == 1 or m == 6 or m == 8):
    print("pon")
else:
    print("hon")
import math
a,b,c,d=list(map(int,input().split()))
a-=1
s=math.floor(b/c)-math.floor(a/c)
e=math.floor(b/d)-math.floor(a/d)
count=b-a-s-e
def lcm(x, y):
  return (x * y)//math.gcd(x, y)


com=lcm(c, d)
tmp=math.floor(b/com)-math.floor(a/com)
print(count+tmp)

### FIXED CODE ###

import math
import fractions
a,b,c,d=list(map(int,input().split()))
a-=1
calc_c=(b-b//c)-(a-a//c)
calc_d=(b-b//d)-(a-a//d)
count=calc_c+calc_d
def lcm(x, y):
    #return (x * y) // math.gcd(x, y)
    return math.floor((x * y) /fractions.gcd(x, y))


com=lcm(c, d)
tmp=(b-b//com)-(a-a//com)
print(count-tmp)