Harryxun/stf_run huggingface dataset:
N = int(input())
X = input()

def popcount(x):
    tmp = x
    count = 0
    while tmp > 0:
        if tmp & 1 == 1:
            count += 1
        tmp >>= 1
    
    return count

tmp_pop_X = X.count('1')
X_tmp = int(X,2)
pc1 = X_tmp % (tmp_pop_X - 1) if tmp_pop_X > 1 else 0
pc2 = X_tmp % (tmp_pop_X + 1)

for i in range(N):
    if X[i] == '0':
        X_next = pc2 + pow(2,N-1-i,tmp_pop_X + 1)
        X_pop_next = tmp_pop_X + 1
    else:
        X_next = pc1 - pow(2,N-1-i,tmp_pop_X - 1)
        X_pop_next = tmp_pop_X - 1
        
    if X_pop_next == 0:
        print(0)
        continue
        
    X_next = X_next % X_pop_next
    ans = 1
    
    while X_next != 0:
        X_next = X_next % popcount(X_next)
        ans += 1
    
    print(ans)

### FIXED CODE ###

n = int(input())
s = input()
x = int(s, 2)
pcx = s.count("1")
pc1 = x % (pcx - 1) if pcx > 1 else 0
pc2 = x % (pcx + 1)

def f(j):
    cnt = 0
    while j:
        j %= bin(j).count("1")
        cnt += 1
    return cnt

for i, y in enumerate(s):
    k = n - 1 - i
    if y == "0":
        print(f((pc2 + pow(2, k, pcx + 1)) % (pcx + 1)) + 1)
    elif pcx > 1:
        print(f((pc1 - pow(2, k, pcx - 1)) % (pcx - 1)) + 1)
    else:
        print(0)
n = int(input())
h = map(int, input().split())
judge = 0
for i in range(n):
  flag=0
  count=0
  I=i
  while flag==0 and (I+count+1)<n:
    if h[I+count]>=h[I+count+1]:
      count+=1
    else:
      flag=1
    judge = max(judge, count)
print(judge)

### FIXED CODE ###

n = int(input())
h = list(map(int,input().split()))
cnt = 0
ans = 0
for i in range(n-1):
    if h[i] >= h[i+1]:
        cnt += 1
        ans = max(ans,cnt)
    else:
        cnt = 0
print(ans)
def Main(S):
    return "Yes" if 'A' in S and 'B' in S else "No"
    
def main():
    S = str(input())
    print(Main(N))

if __name__ == '__main__':
    main()

### FIXED CODE ###

def Main(S):
    return 'No' if S == 'AAA' or S == 'BBB' else 'Yes'

def main():
    S = str(input())
    print(Main(S))

if __name__ == '__main__':
    main()
import math

a, b = map(int, input().split(' '))
lcm = int((a * b) / math.gcd(a, b))
print(lcm)

### FIXED CODE ###

from fractions import gcd

a, b = [int(val) for val in input().split(' ')]
lcm = int((a*b)/gcd(a, b))
print(lcm)
In = list(map(int, input().split()))
sin = set(In)
print("Yes" if len(sin) == 2 else "No")


### FIXED CODE ###

S, T = input().split()
print(T + S)
n,s=map(int,input().split())
a=list(map(int,input().split()))
dp=[0]*6007
ans=0
for i in range(n):
  for j in range(s,0,-1):dp[a[i]+j]+=dp[j]
  d[a[i]]+=i
  ans+=d[s]
print(ans%998244353)

### FIXED CODE ###

n,s=map(int,input().split())
a=list(map(int,input().split()))
dp=[0]*6007
ans=0
for i in range(n):
  for j in range(s,0,-1):dp[a[i]+j]+=dp[j]
  dp[a[i]]+=i+1
  ans+=dp[s]
print(ans%998244353)
H, W = [int(i) for i in input().split()]
A = [[int(i) for i in input().split()] for _ in range(H)]

ans = []
for h in range(H):
    for w in range(W - 1):
        if A[h][w] % 2 == 1:
            A[h][w + 1] += 1
            ans.append([h + 1, w + 1, h + 1, w + 2])
    if h < H - 1 and A[h][w - 1] % 2 == 1:
        A[h + 1][w - 1] += 1
        ans.append([h + 1, W, h + 2, W])

print(len(ans))
for a in ans:
    print(*a)

### FIXED CODE ###

H, W = [int(i) for i in input().split()]
A = [[int(i) for i in input().split()] for _ in range(H)]

ans = []
for h in range(H):
    for w in range(W - 1):
        if A[h][w] % 2 == 1:
            A[h][w + 1] += 1
            ans.append([h + 1, w + 1, h + 1, w + 2])
    if h < H - 1 and A[h][W - 1] % 2 == 1:
        A[h + 1][W - 1] += 1
        ans.append([h + 1, W, h + 2, W])

print(len(ans))
for a in ans:
    print(*a)
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
st = 0
ans = 0

finished = [b[i] == a[i] for i in range(n)]
fcount = sum(finished)
while fcount<n and ans>=0:
  for i in range(st,n):
    if not finished[i] and (b[i-1] <= b[i] >= b[(i+1) % n]):
      ans += (b[i]-a[i])//(b[i-1] + b[(i+1) % n])
      b[i] =a[i]+(b[i]-a[i]) % (b[i-1] + b[(i+1) % n])
      
      #print(b)
      if b[i] == a[i]:
        finished[i] = True
        fcount += 1
      elif b[i] < a[i]:
        ans = -1
        break
      st =(i-1)%n
      break
    elif i == n-1:
      st = 0
      
print(ans)
      



### FIXED CODE ###

s = input()
n = len(s)

i = 0
tmp = ''
ans = 0
while i<n:
  
  if s[i] == tmp:
    if i == n-1:
      break
    tmp = s[i]+s[i+1]
    i+=2
  else:
    tmp = s[i]
    i+=1
  ans +=1
    
print(ans)
D, G = map(int, input().split())
PC = [tuple(map(int, input().split())) for _ in range(D)]
minNum = 10**3

for i in range(2**D):
    point = 0
    num = 0
    leftOvers = []
    for j in range(D):
        if ((i>>j) & 1):
            num += PC[j][0]
            point += PC[j][1] + 100 * (j+1) * PC[j][0]
        else:
            leftOvers.extend([100*(j+1)]*PC[j][0])

    while point < G:
        point += leftOvers.pop()
        num += 1
    minNum = min(num, minNum)
print(minNum)


### FIXED CODE ###

D, G = map(int, input().split())
PC = [tuple(map(int, input().split())) for _ in range(D)]
minNum = 10**3

for i in range(2**D):
    point = 0
    num = 0
    leftOvers = []
    for j in range(D):
        if ((i>>j) & 1):
            num += PC[j][0]
            point += PC[j][1] + 100 * (j+1) * PC[j][0]
        else:
            leftOvers.extend([100*(j+1)]*PC[j][0])

    while point < G:
        if not leftOvers:
            break
        point += leftOvers.pop()
        num += 1
    minNum = min(num, minNum)
print(minNum)
N=int(input())
K=0
for i in N:
    l[i],r[i] = map(int,input().split())
    K+=(r[i]-l[i]+1)
print(K)

### FIXED CODE ###

N=int(input())
K=0
for i in range(N):
    l,r = map(int,input().split())
    K=(r-l+1)+K
print(K)
n = int(intpu())
A = [list(map(int, input().split())) for _ in range(n)]

ans = 0
cannot = 0
for i in range(n):
  for j in range(n):
    detour = min([A[i][k] + A[k][j] for k in range(n) if k!=i and k!=j])
    if detour<A[i][j]:
      cannot = 1
    elif detour>A[i][j]:
      ans += A[i][j]
if cannot:
  print(-1)
else:
  print(ans)

### FIXED CODE ###

n = int(input())
A = [list(map(int, input().split())) for _ in range(n)]

ans = 0
cannot = 0
for i in range(n-1):
  for j in range(i+1,n):
    detour = min([A[i][k] + A[k][j] for k in range(n) if k!=i and k!=j]+[10**18])
    if detour<A[i][j]:
      cannot = 1
    elif detour>A[i][j]:
      ans += A[i][j]
if cannot:
  print(-1)
else:
  print(ans)
ABC = sorted(map(int, input().split()))
K = int(input().split())
print(sum(ABC[:2] + ABC[-1:]*2**K))

### FIXED CODE ###

ABC = sorted(map(int, input().split()))
K = int(input())
print(sum(ABC[:2] + ABC[-1:]*2**K))
from collections import Counter

a,b,c = map(int,input())
if(abs(b-a)==abs(c-b)):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

#
from collections import Counter

a,b,c = map(int,input().split())
if(b-a ==  c-b):
    print("YES")
else:
    print("NO")
def solve(string):
    ins = string.split("\n")
    h, w = map(int, ins[0].split(" "))
    # a = [list(map(lambda x: int(x) % 2 == 1, input().strip().split(" "))) for _i in range(h)]
    a = []
    for i in range(h):
        # tmp = input()
        tmp = ins[i + 1]
        a.append(list(map(lambda x: int(x) % 2 == 1, tmp.strip().split(" "))))
    move = []
    for i in range(h):
        for j in range(w):
            if not a[i][j]:
                continue
            if j < w - 1:
                a[i][j + 1] ^= True
                move.append("{} {} {} {}".format(i + 1, j + 1, i + 1, j + 2))
            elif i < h - 1:
                a[i + 1][j] ^= True
                move.append("{} {} {} {}".format(i + 1, j + 1, i + 2, j + 1))
    move.insert(0, str(len(move)))
    return "\n".join(move)


if __name__ == '__main__':
    line = input().strip()
    # """
    ins = [input() for _ in range(int(line[0]))]
    ins.insert(0, line)
    print(solve("\n".join(ins)))
    # """
    # print(solve(line))


### 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]))
N = input()
B = False
kaisu = 0
array[] = map(int,input().split())
while !B:
	for i in range(N):
  		if array[i]/2 == 1:
    	B = True
  	if B == False:
    	array[] = map(calc ,array[])
    	kaisu++
  	else:
    	break
        
print(kaisu)
    

    

### FIXED CODE ###

N = int(input())
B = False
kaisu = 0
array = list(map(int,input().split()))

def calc(n):
  return int(n) / 2
  
  
while not B:
  for i in range(N):
    if array[i] % 2 == 1:
      B = True
  if not B:
    array = list(map(calc, array))
    kaisu += 1
  else:
    break
        
print(kaisu)
import heapq
#これを加える！！！！
def _heappush_max(heap, item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap)-1)
def _heappop_max(heap):
    """Maxheap version of a heappop."""
    lastelt = heap.pop()    # raises appropriate IndexError if heap is empty
    if heap:
        returnitem = heap[0]
        heap[0] = lastelt
        heapq._siftup_max(heap, 0)
        return returnitem
    return lastelt

n, m = map(int, input().split(' '))
income = []
for i in range(10**5):
  income.append([])
ans = 0

for i in range(n):
  a, b = map(int, input().split(' '))
  income[a].append(b)

# print(n, m)
# print(income)

# tmp = sorted(income, key=lambda x: x[0], reverse=True)
# sorted_income = sorted(tmp, key=lambda x: x[1], reverse=True)

# print(sorted_income)

heap = []
for i in range(1, m+1):
  values = income[i]
  for j in range(len(values)):
    _heappush_max(heap, values[j])
  
  if len(heap) < 1:
    continue
  
  max_value = _heappop_max(heap)
  if max_value:
    ans += max_value
  # print(ans)
  

print(ans)

### FIXED CODE ###

import heapq
#これを加える！！！！
def _heappush_max(heap, item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap)-1)
def _heappop_max(heap):
    """Maxheap version of a heappop."""
    lastelt = heap.pop()    # raises appropriate IndexError if heap is empty
    if heap:
        returnitem = heap[0]
        heap[0] = lastelt
        heapq._siftup_max(heap, 0)
        return returnitem
    return lastelt

n, m = map(int, input().split(' '))
income = []
for i in range(10**5+1):
  income.append([])
ans = 0

for i in range(n):
  a, b = map(int, input().split(' '))
  income[a].append(b)

# print(n, m)
# print(income)

# tmp = sorted(income, key=lambda x: x[0], reverse=True)
# sorted_income = sorted(tmp, key=lambda x: x[1], reverse=True)

# print(sorted_income)

heap = []
for i in range(1, m+1):
  values = income[i]
  for j in range(len(values)):
    _heappush_max(heap, values[j])
  
  if len(heap) < 1:
    continue
  
  max_value = _heappop_max(heap)
  if max_value:
    ans += max_value
  # print(ans)
  

print(ans)
import math

N, K = list(map(int, input().split()))
mod = 10**9+7


def combination(a, b):
    ans = (math.factorial(a) // math.factorial(a-b)) // math.factorial(b)
    return ans


for i in range(1, K+1):
    ans1 = combination(N-K+1, i)
    ans2 = combination(K-1, i-1)
    print(ans1*ans2 % mod)


### FIXED CODE ###

import math

N, K = list(map(int, input().split()))
mod = 10**9+7


def combination(a, b):
    ans = (math.factorial(a) // math.factorial(a-b)) // math.factorial(b)
    return ans


for i in range(1, K+1):
    if (N-K+1-i) >= 0:
        ans1 = combination(N-K+1, i)
        ans2 = combination(K-1, i-1)
        print(ans1 % mod*ans2 % mod)
    else:
        print(0)
def kai(n):
  if (n == 1):
    return 1
  else:
    return n * kai(n-1) % (1e9 + 7)

n = int(input())
print(kai(n))


### FIXED CODE ###

def imp_kai(n):
    ac = 1
    for i in range(n):
        ac *= i + 1
        ac = ac % (1e9 + 7)
    return ac % (1e9 + 7)

n = int(input())
print(int(imp_kai(n)))
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()

x,y = na()
hx = {"A":1, "B":2, "C":3, "D":4, "E":5, "F":6}

if hx[x] > hx[y]:
    print(">")
elif hx[x] < hx[y]:
    print("<")
else:
    print("=")


### FIXED CODE ###

import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()

x,y = ns().split()
hx = {"A":1, "B":2, "C":3, "D":4, "E":5, "F":6}

if hx[x] > hx[y]:
    print(">")
elif hx[x] < hx[y]:
    print("<")
else:
    print("=")
N = int(input())
A = sorted(list(map(int, input().split())))

ans = A[N]
cnt = 1
i = 1

while cnt <= N:
    ans += 2*A[N-i]
    i += 1
    cnt += 2

if N != cnt:
    ans -= A[N-i]

print(ans) 

### FIXED CODE ###

N = int(input())
A = sorted(list(map(int, input().split())), reverse=True)

ans = -A[0]
for i in range(N):
    ans += A[i//2]
print(ans)
n,m,x=map(int,input().split())
arr=[[0 for i in range(m+1)] for j in range(n)]
b=[0]*18

flag=1
for i in range(n):
    arr[i]=list(map(int,input().split()))
for i in range(2**n):
    b=[0]*18
    for j in range(n):
        flag=1
        if (1& i>>j):
            for s in range(m+1):
                b[s]= b[s]+arr[j][s]
        for y in range(1,m+1):
            if(b[y]<x):
                flag=0
                
        if flag :
            if ans==-1 or ans>b[0]:
                ans=b[0]
print(ans)


### FIXED CODE ###

n,m,x=map(int,input().split())
arr=[[0 for i in range(m+1)] for j in range(n)]
b=[0]*18
ans=-1
flag=1
for i in range(n):
    arr[i]=list(map(int,input().split()))
for i in range(2**n):
    b=[0]*18
    for j in range(n):
        flag=1
        if (1& i>>j):
            for s in range(m+1):
                b[s]= b[s]+arr[j][s]
        for y in range(1,m+1):
            if(b[y]<x):
                flag=0
                
        if flag :
            if ans==-1 or ans>b[0]:
                ans=b[0]
print(ans)
= input()
t = s[len(s)//2]
j = len(s)//2
i = len(s)-j-1
ans = j
while i >= 0:
    if s[i] != t or s[j] != t:
        break
    ans += 1
    i -= 1
    j += 1

print(ans)

### FIXED CODE ###

s = input()
t = s[len(s)//2]
j = len(s)//2
i = len(s)-j-1
ans = j
while i >= 0:
    if s[i] != t or s[j] != t:
        break
    ans += 1
    i -= 1
    j += 1

print(ans)
A,B = int(input())
if A<6:
  print(0)
elif A<13:
  print(B/2)
else:
  print(B)

### FIXED CODE ###

A,B = map(int,input().split())
if A<6:
  print(0)
elif A<13:
  print(B//2)
else:
  print(B)
nums = input().split()
a = int(nums[0])
b = int(nums[1])
c = int(nums[2])

if a <= b <= c :
    print('a,b,c)
elif a <= c <= b
    print('a,c,b)
elif b <= a <= c:
    print('b,a,c')
elif b <= c <= a:
    print('b,c,a)
elif c <= a <= b:
    print('c,a,b')
else:
    print('c,b,a)

### FIXED CODE ###

nums = input().split()
a = int(nums[0])
b = int(nums[1])
c = int(nums[2])
  
if a <= b <= c:
    print(a, b, c)
  
elif a <= c <= b:
    print(a, c, b)
  
elif b <= a <= c:
    print(b, a, c)
  
elif b <= c <= a:
    print(b, c, a)
  
elif c <= a <= b:
    print(c, a, b)
  
else:
    print(c, b, a)
import math

A, B = input().split()
A = int(A)
B_p = int(B.split(".")[0])
B_c = int(B.split(".")[1])

print(A * B_p + int(str(A * B_c)[:-2]))

### FIXED CODE ###

import math

A, B = input().split()

A = int(A)
B_p = int(B.split(".")[0])
B_c = int(B.split(".")[1])

if (A == 0) or (B == 0):
  print(0)
else:
  ABp = A * B_p
  ABc = int(str(A * B_c)[:-2]) if len(str(A * B_c))>2 else 0
  print(ABp+ABc)
n, k = map(int,input().split())
a = list(map(int, input().split()))
t = [1]
x = [0]*n
x[0] = 1
y = 1
z = 0
d = 0
for i in range(k):
    t.append(a[t[i]-1])
    if x[a[t[i]-1]-1] != 0:
        y = x[a[t[i]-1]-1]
        z = i+2
        b = [a[t[i]-1]]
        break
    else:
        x[a[t[i]-1]-1] += i+2
        z = i+2

d = z-y

print(t)
print(x)
print(y)
print(z)

if d != 0:
    r = (k - y) % d
else:
    r = k - y

for i in range(r+1):
    b.append(a[b[i]-1])

print(b[r+1])


### FIXED CODE ###

n, k = map(int,input().split())
a = list(map(int, input().split()))
t = [1]
x = [0]*n
x[0] = 1
y = 1
z = 0
d = 0
flag = False
for i in range(k):
    t.append(a[t[i]-1])
    if x[a[t[i]-1]-1] != 0:
        y = x[a[t[i]-1]-1]
        z = i+2
        b = [a[t[i]-1]]
        break
    else:
        x[a[t[i]-1]-1] += i+2
        z = i+2
        b = [a[t[i]-1]]
    if i == k - 1:
        flag = True

if flag:
    print(a[t[k-1]-1])
    exit()

d = z-y


if d != 0:
    r = (k - y) % d
else:
    r = k - y

for i in range(r+1):
    b.append(a[b[i]-1])

print(b[r+1])
from collections import deque
def check():
    S = input()
    x, y = map(int, input().split())
    fs = list(map(len,S.split('T')))
    xs = fs[::2]
    ys = fs[1::2]
    xs.sort(reverse = True)
    N = len(xs)
    M = len(ys)
    cum = [0]*(N+1)
    for i in range(N-1,-1,-1):
        cum[i] = cum[i+1]+xs[i]
    pos = deque([-x])
    for i in range(N):
        l = len(pos)
        if l == 0:
            return False
        for _ in range(l):
            d = pos.popleft()
            if abs(d+xs[i])<=cum[i+1]:
                pos.append(d+xs[i])
            if abs(d-xs[i])<=cum[i+1]:
                pos.append(d-xs[i])
    if 0 not in pos:
        return False
    ys.sort(reverse = True)
    cum = [ys[-1]]*(M+1)
    for i in range(M-1,-1,-1):
        cum[i] = cum[i+1]+ys[i]
    pos = deque([0])
    for i in range(M):
        l = len(pos)
        if l == 0:
            return False
        for _ in range(l):
            d = pos.popleft()
            if abs(d+ys[i])<=cum[i+1]+abs(y):
                pos.append(d+ys[i])
            if abs(d-ys[i])<=cum[i+1]+abs(y):
                pos.append(d-ys[i])
    if y not in pos:
        return False
    return True
if check():
    print('Yes')
else:
    print('No')

### FIXED CODE ###

from collections import deque
import sys
sys.setrecursionlimit(10**8)

def dp(dp_l,i,N,xs,cum,now):
    if i == N:
        if now == 0:
            return True
        return False
    if abs(now) > cum[i]:
        return False
    if dp_l[i][abs(now)] != -1:
        return dp_l[i][abs(now)]
    dp_l[i][abs(now)] = dp(dp_l,i+1,N,xs,cum,now+xs[i]) or dp(dp_l,i+1,N,xs,cum,now-xs[i])
    return dp_l[i][abs(now)]

def check():
    S = input()
    x, y = map(int, input().split())
    fs = list(map(len,S.split('T')))
    if len(fs)<3:
        if x != fs[0]:
            return False
        if len(fs)==1:
            if y == 0:
                return True
            else:
                return False
        if y != fs[1] and y != -fs[1]:
            return False
        return True
    xs = fs[2::2]
    ys = fs[1::2]
    xs.sort(reverse = True)
    N = len(xs)
    M = len(ys)
    cum = [0]*(N+1)
    for i in range(N-1,-1,-1):
        cum[i] = cum[i+1]+xs[i]
    dp_l = [[-1]*(cum[0]+1) for _ in range(N)]
    if not dp(dp_l,0,N,xs,cum,fs[0]-x):
        return False
    ys.sort(reverse = True)
    cum = [ys[-1]]*(M+1)
    for i in range(M-1,-1,-1):
        cum[i] = cum[i+1]+ys[i]
    dp_l = [[-1]*(cum[0]+1) for _ in range(M)]
    if not dp(dp_l,0,M,ys,cum,-y):
        return False
    return True
if check():
    print('Yes')
else:
    print('No')
def main():
    import math
    a = list(map(int,input().split()))
    b = list(map(int,input().split()))
    c = list(map(int,input().split()))
    d = [a[0],b[0],c[0]]
    e = [a[1],b[1],c[1]]
    f = [a[2],b[2],c[2]]
    g = [a[0],b[1],c[2]]
    h = [a[2],b[1],c[0]]
    n = int(input())
    listB = [int(input()) for x in range(n)]
    C = itertools.combinations(listB,3)
    if a in C or b in C or c in C or d in C or e in C or f in C or g in C or h in C:
      print("Yes")
    else:
      print("No")
main()

### FIXED CODE ###

def main():
    import itertools
    a = tuple(map(int,input().split()))
    b = tuple(map(int,input().split()))
    c = tuple(map(int,input().split()))
    d = (a[0],b[0],c[0])
    e = (a[1],b[1],c[1])
    f = (a[2],b[2],c[2])
    g = (a[0],b[1],c[2])
    h = (a[2],b[1],c[0])
    n = int(input())
    listB = [int(input()) for x in range(n)]
    X = itertools.permutations(listB,3)
    R = list(X)
    if a in R or b in R or c in R or d in R or e in R or f in R or g in R or h in R:
      print("Yes")
    else:
      print("No")
main()
x,n = map(int, input().split())
p = list(map(int, input().split()))
mini = 100
for i in range(1,101):
    if not i in p:
        if mini>abs(x-i):
            ans = i
            mini=abs(x-i)
print(ans)

### FIXED CODE ###

x,n = map(int, input().split())
p = list(map(int, input().split()))
mini = 1000
for i in range(-200,200):
    if not i in p:
        if mini>abs(x-i):
            ans = i
            mini=abs(x-i)
print(ans)
n,m,k = list(map(int,input().split()))

a = list(map(int,input().split()))
b = list(map(int,input().split()))
#a.reverse()
#b.reverse()

if k < a[0] and k < b[0]:
    print(0)

count = [[0 for i in range(n + 1)] for j in range(m + 1)]

answer = 0
for i in range(n+2):
    for j in range(m):
        if j != 0:
            count[i][j] = count[i][j-1] + a[j-1]
        if count[i][j] > k:
        #    print(count[i][j])
            break
        if answer < i + j and count[i][j] <= k:
            #print(count[i][j],i,j)
            answer = i + j
    if i == n + 1:
        break
    count[i+1][0] = count[i][0] + b[i]
    if count[i+1][j] > k:
        break 
    #if answer < i + j and count[i][j] <= k:
        #answer = i + j
        #print(count[i][j])

print(answer)


### FIXED CODE ###

n,m,k = list(map(int,input().split()))

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

asum = [0]
bsum = [0]

for i in range(n):
    asum.append(asum[i] + a[i])
for i in range(m):
    bsum.append(bsum[i] + b[i])

best = m
answer = 0
for i in range(n+1):
    j = best
    while 1:
        if bsum[j] <= (k - asum[i]):
            best = j
            if answer < i + j:
                answer = i + j
            break
        j -= 1
        if j < 0:
            break

print(answer)
n = int(input())
s = input()
 
if n%2 == 1:
  print("No")
  return
 
slise = (n/2)
a = s[:int(slise)]
b = s[int(slise):]
 
if a==b:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

import sys

n = int(input())
s = input()
 
if n%2 == 1:
  print("No")
  sys.exit()
 
slise = (n/2)
a = s[:int(slise)]
b = s[int(slise):]
 
if a==b:
  print("Yes")
else:
  print("No")
n, k = [int(j) for j in input().split(' ')]
p = input().split(' ')
 
p.sort()
sum = 0
 
for i in range(0,k):
  sum+=int(p[i])
  
return sum

### FIXED CODE ###

char = input()
if char.islower():
  print('a')
else:
  print('A')
l = list(map(float,input.split()))
m =l［0］/l［1］
print(m)

### FIXED CODE ###

l = list(map(float,input().split()))
m =l[0]/l[1]
print(m)
K = int(input())
x = 7
count = 1

if 7%K==0:
  print("1")
  exit(0)
if 77%==0:
  print("2")
  exit(0)
if 777%==0:
  print("3")
  exit(0)
if 7777%==0:
  print("4")
  exit(0)
if 77777%==0:
  print("5")
  exit(0)
if 777777%==0:
  print("6")
  exit(0)
if 7777777%==0:
  print("7")
  exit(0)
  
print("-1")

### FIXED CODE ###

def calc(k):
    cur = 0
    for i in range(1, 10 ** 7):
        cur *= 10
        cur += 7
        cur %= k
        if cur == 0:
            return i

    return -1


k = int(input())
print(calc(k))