peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
N = int(input())
As = list(map(int, input().split()))
P = 10**9 + 7

rlt = 0
pw = 1
for i in range(61):
  c0 = 0
  c1 = 0
  for j in range(N):
    a = As[j]
    if a % 2 == 0:
      c0 += 1
    else:
      c1 += 1
    As[j] = a//2
  rlt += c0*c1*pw % P
  rlt %= P
  pw *= 2
  
print(rlt)
# Judge status: Accepted
def solve():
  N, K = map(int, input().split())
  H = [int(input()) for _ in range(N)]
  H.sort()
  ans = float('inf')
  for i in range(N):
    if i+K>N:
      break
    ans = min(H[i+K-1]-H[i],ans)
  return ans
print(solve())
# Judge status: Accepted
import statistics
import math
n,l = map(int,input().split())	
t = []
for i in range(l,n+l):
	t.append(i)

if 0 in t:
	print(sum(t))
else:
	if t[0] <0:
		t.pop()
		print(sum(t))

	else:
		t.pop(0)
		#print(t)
		print(sum(t))
# Judge status: Accepted
from sys import stdin, stdout

int_in = lambda: int(stdin.readline())
arr_in = lambda: [int(x) for x in stdin.readline().split()]
mat_in = lambda rows: [arr_in() for y in range(rows)]
str_in = lambda: stdin.readline().strip()
out = lambda o: stdout.write("{}\n".format(o))
arr_out = lambda o: out(" ".join(map(str, o)))
bool_out = lambda o: out("YES" if o else "NO")
tests = lambda: range(1, int_in() + 1)
case_out = lambda i, o: out("Case #{}: {}".format(i, o))


def solve(x):
    return x.index(0) + 1


if __name__ == "__main__":
    x = arr_in()
    out(solve(x))
# Judge status: Wrong Answer
from collections import OrderedDict

n, k = map(int, input().split())
a = tuple(map(int, input().split()))

returned = None
i = 0
aa = 0
visited = OrderedDict([(0, 0)])
while i < n:
    aa = a[aa] - 1
    i = i + 1
    if aa in visited:
        returned = (visited[aa], i)
        break
    visited[aa] = i

loop = returned[1] - returned[0]

if k >= len(visited):
    k = k % (returned[1] - returned[0])
    if k < returned[0]:
        k = k + returned[0]

print(list(visited.keys())[k] + 1)
# Judge status: Wrong Answer
n = int(input())
def main(n):
    if n == 1:
        return 1,0
    
    if n == 3:
        return 2,0
    m = n //2 
    for i in range(1,m+1):
        if i * (i + 1) <= 2*n < (i+1)*(i+2):
           right  = i + 1
           break
       
    diff = right * (right+1) //2 - n
       
    return right+1,diff


right,diff = main(n)

for i in range(1,right):
    if i != diff:
        print(i)
# Judge status: Accepted
a, b, x = map(int, input().split())

if a % x != 0 :
    aa = a//x+1
else :
    aa = a//x


bb = b //x

print(bb - aa  + 1 )
# Judge status: Wrong Answer
N=int(input())
A=[int(input()) for _ in range(N)]
A.sort()
ans=0
b=0
c=0
for i in range(N):
  if b!=A[i]:
    if c%2!=0:
      ans+=1
    b=A[i]
    c=1
  else:
    c+=1
print(ans)
# Judge status: Accepted
n=int(input())

def ketacul(x):
    keta=1
    while(x/10>=1):
        x=x/10
        keta+=1
    return keta
count=0
for i in range(1,n+1):
    a=ketacul(i)
    if a%2==1:
        count+=1
print(count)
# Judge status: Wrong Answer
N = int(input())
if N < 105:
    print(0)
elif N < 165:
    print(1)
else:
    print(2)
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
print("Yes")
# Judge status: Wrong Answer
def LI():
    return list(map(int, input().split()))


K, S = LI()
ans = 0
for i in range(K+1):
    total = S-i
    kosu = total+1
    if total > 2*K:
        continue
    if total > K:
        kosu -= (total-K)*2
        ans += kosu
    else:
        ans += kosu
print(ans)
# Judge status: Accepted
import sys
s = input()
n = len(s)
ans =0
ans += s[0::2].count("0")
ans += s[1::2].count("1")
if  n / 2 <= ans:
    print(n - ans)
else:
    print(ans )
# Judge status: Wrong Answer
sx, sy, tx, ty = map(int, input().split())
print("U"*(ty-sy) + "R"*(tx-sx+1) + "D"*(ty-sx+1) + "U" + "L" + "U"*(ty-sy+1) + "R"*(tx-sx+1) + "D"*(ty-sy+1) + "L"*(tx-sx))
# Judge status: Accepted
A = [[int(_) for _ in input().split()] for _ in range(3)]
N = int(input())
B = [int(input()) for _ in range(N)]

for a in A:
    for b in B:
        if b in a:
            a[a.index(b)] = 0

ans = "No"
if [A[i][i] for i in range(3)] == [0, 0, 0]:
    ans = "Yes"
if [A[i][2-i] for i in range(3)] == [0, 0, 0]:
    ans = "Yes"
for i in range(3):
    if A[i] == [0, 0, 0]:
        ans = "Yes"
    if [A[j][i] for j in range(3)] == [0, 0, 0]:
        ans = "Yes"
print(ans)
# Judge status: Accepted
S=input()
K=int(input())
ans="1"
for i in range(K):
    if S[i]!="1":
        ans=S[i]
        break
print(ans)
# Judge status: Wrong Answer
a, b, x = map(int, input().split())

if (a - 1) < 0:
    count_a = 0
else:
    count_a = (a - 1) // 2 + 1

count_b = b // x + 1

print(count_b - count_a)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans=0
for i in range(n):
    if b[i] > a[i]:
        b[i] -= a[i]
        ans += a[i]
        if b[i] > a[i+1]:
            ans += a[i+1]
            a[i+1] = 0
        else:
            ans += b[i]
            a[i+1] -= b[i]
    else:
        ans += b[i]
        b[i]=0
print(ans)
# Judge status: Wrong Answer
N = int(input())
dict = {}
for i in range(1, N+1):
    S, P_str = tuple(input().split())
    P = int(P_str)
    try:
        dict[S].append((P, i))
    except:
        dict[S] = [(P, i)]

items = sorted(dict.items(), key=lambda x: x[1], reverse=True)
for city, info in items:
    for p, n in sorted(info, reverse=True):
        print(n)
# Judge status: Wrong Answer
x = int(input())
happy = 0

happy += 1000*(x//500)
happy += 5*((x%500)%5)
print(happy)
# Judge status: Wrong Answer
def main():
    import collections
    n = int(input())
    mylist = []
    for i in range(n):
        s = input()
        mylist.append(s)
    c = collections.Counter(mylist)
    print('AC × ' + str(c['AC']))
    print('WA × ' + str(c['WA']))
    print('TLE × ' + str(c['TLE']))
    print('RE × ' + str(c['RE']))
if __name__ == "__main__":
    main()
# Judge status: Wrong Answer

N = int(input())
A = []
B = []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

A.sort()
B.sort(reverse=True)
mid1 = A[(N + 1) // 2 - 1]
mid2 = B[(N + 1) // 2 - 1]

if N % 2 == 1:
    print(mid2 - mid1 + 1)
else:
    print((mid2 - mid1) * 2 - 1)
# Judge status: Wrong Answer
n = int(input())
ll = list(map(int,input().split()))

ll = sorted(ll)

import bisect

ans = 0
for i in range(n):
    for j in range(i+1, n):
        k = ll[i] + ll[j]
        idx1 = bisect.bisect_left(ll, ll[j])
        idx2 = bisect.bisect_left(ll, k)
        ans += idx2 - idx1 - 1
print(ans)
# Judge status: Wrong Answer
import itertools
import bisect
N = int(input())
L = list(map(int, input().split()))
ans = 0
LS = sorted(L)
l = len(LS)
print(LS)
for i in range(l):
  for j in range(l):
    if i < j:
      for k in range(j+1,l):
        if LS[i]+LS[j] > LS[k]:
          ans += 1
        else:
          break
print(ans)
# Judge status: Wrong Answer
import numpy as np

N=int(input())
M=10**9+7
A=[int(x) for x in input().split()]
A=np.array(A)

ans=0
for i in range(70):
  #one=sum([a>>i&1 for a in A])
  one=np.sum((A>>i)&1)
  zero=N-one
  ans+=(one*zero)*pow(2,i,M)
  ans%=M
  #print(one,zero)
print(ans)
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
print('Yes' if a<c<b else 'No')
# Judge status: Wrong Answer
n = float(input())
if(n%9==0):
    print("YES")
else:
    print("NO")
# Judge status: Accepted
n,m=map(int,input().split())
a=[[int(i) for i in input().split()] for l in range(n)]
b=[[int(i) for i in input().split()] for l in range(m)]
for A in a:
    c=1
    r=0
    m=10000000000
    for B in b:
        k=abs(A[0]-B[0])+abs(A[1]-B[1])
        if m>k:
            m=k
            r=c
        c+=1
    print(r)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

check = {}
ans = 0

for i in range(N):
    x = i - A[i]
    y = A[i] + i
    ans += check.get(x, 0)
    check.setdefault(y, 0)
    check[y] += 1

print(ans)
# Judge status: Accepted
import math
n = int(input())

def judge(num):
    count=0
    for i in range(1,num+1):
        if num%i==0:
            count+=1
    return count

ans=0
for i in range(3,n+1,2):
    if judge(i)==8:
        ans+=1

print(ans)
# Judge status: Accepted
import sys
input = sys.stdin.readline
a,b,c,d = [int(i) for i in input().split()]
dab =abs(b-a)
dbc = abs(b-c)
ans = "No"
dac = abs(a-c)
if (dab <=d and dbc <= d) or dac<=d :
    ans = "Yes"
print(ans)
# Judge status: Accepted
n = int(input())
d = [list(map(int, input().split())) for _ in range(n)]

exist = False
for i in range(n-2):
    for j in range(3):
        if d[i+j][0] != d[i+j][1]:
            break
    else:
        exist = True
if exist:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
import math
N, K = map(int, input().split())
A=list(map(int,input().split()))
maxA = max(A)
right = maxA+1
left = 0
while(right-left>1):
    mid = (left+right)//2
    count = 0
    for i in A:
        count += (i-1)//mid
    if count > K:
        left = mid
    elif count <= K:
        right = mid
print(mid)
# Judge status: Accepted
n = int(input())
L = list(map(int,input().split()))

L = sorted(L,reverse=True)

#print(L)
t = 0
a = 0
for i in range(1,n):
    t += L[i-1]
    a += (t * L[i]) #% (10**9 + 7)
#    print(t,a)

print(a % (10**9 + 7))
# Judge status: Wrong Answer
import sys

n = int(sys.stdin.readline().rstrip())
a = [int(x) for x in sys.stdin.readline().rstrip().split()]

a_set = set()
counter_wild = 0
for x in a:
    if x>=3200:
        counter_wild+=1
    else:
        a_set.add(x//400)
print(max(1,len(a_set)),min(8,len(a_set)+counter_wild))
# Judge status: Accepted
def main():
    a,b = map(int,input().split())

    if (a+b) % 2 != 0:
        print('IMPOSSIBLE')
    else:
        print((a+b)//2)

if __name__ == '__main__':
    main()
# Judge status: Accepted
x = int(input())

for k in range(1, 100000):
  if (k * x) % 360 == 0:
    print(k)
    exit()
# Judge status: Wrong Answer
def solve(N, A, B):
    if A % 2 == B % 2:
        return (B - A) // 2
    return int(min(A-1, N-B) + 1 + (B - A -1)/2)

if __name__ == "__main__":
    n, a, b = map(int, input().split())
    print(int(solve(n, a, b)))
# Judge status: Accepted
s,t=input().split()
a,b=map(int,input().split())
u=input()
if u==s:
  a-=1
else:
  b-=1
print(a,b)
# Judge status: Wrong Answer
import copy
N, X, Y = input().split()
N = int(N)
X = int(X)
x = X - 1
Y = int(Y)
y = Y -1

A = [[0] * N for _ in range(N)]
for i in range(N):
    for j in range(N-i):
        A[i][i + j] = min(abs(x- i) +1 +abs(y-i-j),j)
A[X-1][Y-1] = 1
ans = []

for p in range(N):
    ans.append(sum(A, []))
    print(ans)
for t in range(N):
    if t == 0:
        continue
    sum =  A.count(t)
    print(ans[0].count(t))
# Judge status: Accepted
n = int(input())
restaurants = []
for i in range(n):
    s, p = input().split()
    restaurants.append((s, int(p)))
sorted_list = sorted(restaurants, key=lambda x:x[1], reverse=True)
sorted_list.sort(key=lambda x:x[0])

for i in range(n):
    print(restaurants.index(sorted_list[i]) + 1)
# Judge status: Wrong Answer
from collections import Counter
def solve():
    n = int(input())
    a = list(map(int, input().split()))

    l = Counter(a)
    sq = []
    for i,j in l.items():
        if j >= 2:
            sq.append(i)

    if len(sq) >= 2:
        sq.sort()
        return sq[-1]*sq[-2]
    else:
        return 0
    

print(solve())
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
from collections import Counter
a = Counter(a)
lis = []
 
for i,j in a.items():
    lis += [i]*(j//2)
 
#print(lis)
 
lis.sort(reverse=True)
if len(lis) <= 1:
    ans = 0
else:
    ans = lis[0]*lis[1]
 
print(ans)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
from collections import Counter
from operator import itemgetter
C = Counter(A)
Cs = sorted(C.items(), key=itemgetter(0), reverse=True)
e = []
for k,v in Cs:
    if v >= 2:
        e.append(k)
        if len(e) >= 2: break
if len(e) >= 2:
    print(e[0]*e[1])
else:
    print(0)
# Judge status: Wrong Answer
n=[int(input()) for _ in range(5)]
try:
  m=10-min([i%10 for i in n if i%10!=0])
  n=[i if i%10==0 else i+(10-i%10) for i in n]
  print(sum(n)-m)
except:
  print(60)
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    N, M = map(int, input().split())

    ans = set(range(1, M+1))
    for _ in range(N):
        ans &= set(map(int, input().split()[1:]))
    print(len(ans))
    
if __name__ == '__main__':
    main()
# Judge status: Accepted
S=input()
a=0
b=0
c=0
for i in range(len(S)):
  if S[i]=='a':
    a+=1
  elif S[i]=='b':
    b+=1
  else:
    c+=1
# print(a,b,c)
if abs(a-b)<=1 and abs(b-c)<=1 and abs(c-a)<=1:
  print('YES')
else:
  print('NO')
# Judge status: Accepted
K=int(input())

def gcd(x,y):
    if x<y:
        temp=x
        x=y
        y=temp
    if x%y==0:
        return y
    else:
        nx=y
        ny=x%y
        return gcd(nx,ny)
ans=0
for a in range(1,K+1):
    for b in range(1,K+1):
        g=gcd(a,b)
        for c in range(1,K+1):
            ans+=gcd(g,c)

print(ans)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))

ans = 0
i = 0
while i < N-2:
  tmp = i

  while (A[tmp+1] - A[tmp]) * (A[tmp+2] - A[tmp+1]) >= 0:
    tmp += 1
    if tmp == N-2:
      break
  else:
    if tmp == N-3:
      ans +=1
  ans += 1 
  i = tmp+2
  if i == N-2:
    ans += 1
print(ans)
# Judge status: Accepted
s = input()
s_len = len(s)
n = 2019
mod_list = [0] * n
mod_list[0] = 1

p = 1
d = 0
for t in reversed(s):
    d += int(t) * p
    m = d % n
    mod_list[m] += 1
    p *= 10
    p %= 2019

result = sum(i * (i - 1) // 2 for i in mod_list)
print(result)
# Judge status: Accepted
P, Q, R = map(int ,input().split())
print(min(P+Q, Q+R, R+P))
# Judge status: Accepted
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

print(-(-n//min(a,b,c,d,e))+5-1)
# Judge status: Accepted
N, K = list(map(int, input().split()))
Pd = 1 / N
Pc = 0.5
ans = []
def f(i):
  P = Pd
  while(i<K):
    P = P * Pc
    i = 2 * i
  return P

for j in range(1,N+1):
  ans.append(f(j))
  
print(sum(ans))
# Judge status: Wrong Answer
n,m=map(int,input().split())
if n==m:
  print("yes")
else:
  print("no")
# Judge status: Accepted
s = list(input())
k = int(input())
num = len(s)

for i in range(num):
    a = 122-ord(s[i])+1
    if a <= k and s[i] != 'a':
        k -= a
        s[i] = 'a'
if k > 0:
    s[-1] = chr(ord(s[-1])+k%26)
print(*s, sep='')
# Judge status: Accepted
s = input()

# https://ikatakos.com/pot/programming_algorithm/contest_history/atcoder/2019/0817_agc037

ans = 0
prev = ''
i = 0
while i < len(s):
    c = s[i]
    # 前の文字と現在の文字が同じ
    if c == prev:
        i += 1
        if i == len(s):
            break
        # 2文字になる
        c += s[i]
    prev = c
    i += 1  # 次の文字へ進む
    ans += 1

print(ans)
# Judge status: Wrong Answer
I = input()
import re
if re.match("(a|i|u|e|o)1", I):
    print('vowel', flush=True)
else:
    print('consonant', flush=True)
# Judge status: Accepted
s=input();d=input();n=len(s)
di={"abcdefghijklmnopqrstuvwxyz"[i]:i for i in range(26)}
sl,dl=[set() for _ in range(26)],[set() for _ in range(26)]
for i,(x,y) in enumerate(zip(s,d)):
  sl[di[x]].add(i);dl[di[y]].add(i)
for i in dl:
  if i and i not in sl :print("No");exit() 
print("Yes")
# Judge status: Accepted
#!/usr/bin/env python3

#import
#import math
#import numpy as np
N, W = map(int, input().split())
wv = [list(map(int, input().split())) for _ in range(N)]

dp = [0] * (W + 1)

for w, v in wv:
    for i in range(W, 0, -1):
        if i - w < 0:
            break

        dp[i] = max(dp[i], dp[i - w] + v)
            
print(dp[W])
# Judge status: Wrong Answer
a, b, c = map(int, input().split())

if abs(a - b) == abs(b - c):
  print('YES')
else:
  print('NO')
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
s = 0
for i in range(n):
    if a[i] < 0:
        a[i] = -a[i]
        s += 1
if s % 2 == 0:
    print(sum(a))
else:
    print(sum(a) - 2 * min(a))
# Judge status: Accepted
import bisect
from sys import stdin

def get_result(data):
    N = data[0][0]
    A = sorted(data[1])
    B = sorted(data[2])
    C = sorted(data[3])
    ans = 0
    for mid_val in B:
      num_a = bisect.bisect_left(A, mid_val)
      num_c = N - bisect.bisect_right(C, mid_val)
      ans += num_a * num_c
    return ans


if __name__ == '__main__':
    raw_data = [val.rstrip() for val in stdin.readlines()]
    data = [list(map(int, val.split(' '))) for val in raw_data]
    result = get_result(data)
    print(result)
# Judge status: Accepted
x = int(input())

if 400 <= x <= 599:
    print("8")
elif 600 <= x <= 799:
    print("7")
elif 800 <= x <= 999:
    print("6")
elif 1000 <= x <= 1199:
    print("5")
elif 1200 <= x <= 1399:
    print("4")
elif 1400 <= x <= 1599:
    print("3")
elif 1600 <= x <= 1799:
    print("2")
else:
    print("1")
# Judge status: Wrong Answer
N,M = map(int,input().split())
AC_flag = [False]*N
WA_count = [0]*N
for m in range(M):
    P,S = map(str,input().split())
    p = int(P)
    if AC_flag[p-1] == False and S == "AC":
        AC_flag[p-1] = True
    if AC_flag[p-1] == False and S == "WA":
        WA_count[p-1] += 1
print(*[sum(AC_flag),sum(WA_count)])
# Judge status: Accepted
n = int(input())
if n < 600:
    print(8)
elif n < 800:
    print(7)
elif n < 1000:
    print(6)
elif n < 1200:
    print(5)
elif n < 1400:
    print(4)
elif n < 1600:
    print(3)
elif n < 1800:
    print(2)
else:
    print(1)
# Judge status: Wrong Answer
import math

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

point = a/0.08
seg_a = (math.ceil(point), math.floor(point + 12.5))

point = b/0.1
seg_b = (point, point + 9)

if seg_b[1] < seg_a[0]:
    print(-1)
else:
    print(int(seg_a[0]))
# Judge status: Accepted
S = input()
T = input()

ans = 'Yes'
for i in range(len(S)):
  if S[i] != T[i]: 
    ans = 'No'
    break

print(ans)
# Judge status: Wrong Answer
A,B = [int(i) for i in input().split()]
if A + B > 24:
  print(A + B -24)
else:
  print(A+B)
# Judge status: Accepted
D,N = map(int,input().split())

if D == 0:
    c = N//100
    print(N+c)
else:
    tmp = 100 ** D
    c = N//100
    print(tmp*N+c*tmp)
# Judge status: Accepted
n,k = map(int,input().split())
a = list(map(int,input().split()))

if(len(set(a)) <= k):
    print(0)
else:
    dic_a = {x:0 for x in set(a)}
    for i in a:
        dic_a[i] += 1
    sum = 0
    a = sorted(dic_a.values(),reverse=True)
    for i in range(k,len(a)):
        sum += a[i]
    print(sum)
# Judge status: Accepted
A,B,C = map(int,input().split())
if A<=C<=B:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
A, B = map(int, input().split())

ans = 0
for i in range(A, B+1):
    i = str(i)
    former = i[:2]
    latter = i[3:]
    if former in [latter, latter[::-1]]:
        ans += 1
print(ans)
# Judge status: Wrong Answer

def main():
    X = input()
    mini = 100000

    for index in range(len(X)-3):
        if mini > abs(int(X[index:index+3]) - 753):
            mini = abs(int(X[index:index+3]) - 753)
    print (mini)




if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
import math
n,d = map(int,input().split())
x = [list(map(int,input().split())) for _ in range(n)]
def distance(a,b):
  s = 0
  for i in range(d):
    s += (a[i]-b[i])**2
  return math.sqrt(ans)
ans = 0
for i in range(n-1):
  for j in range(i+1,n):
    if distance(x[i],x[j])//1 == distance(x[i],x[j]):
      ans += 1
print(ans)
# Judge status: Wrong Answer
N = int(input())
print (N*(N+1)/2)
# Judge status: Wrong Answer
s=sorted(input())
print('Yes'if(s[::2]==s[1::2]==s[1:3])else'No')
# Judge status: Wrong Answer
#!/usr/bin/env python3


def main():
    N, L = map(int, input().split())
    if L >= 0:
        # L + 1 から L + N - 1 の和
        print((N - 1) * (2 * L + N) // 2)
    elif L <= -N:
        # L から L + N - 2 の和
        print((N - 1) * (2 * L + N - 2) // 2)
    else:
        # L から L + N - 1 の和
        print((N - 1) * (2 * L + N - 1) // 2)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
def calculate(n,m,arr):
    arr.sort()
    drr = list([])
    for index in range(1,len(arr)):
        drr.append(arr[index] - arr[index-1])
    drr.sort()
    drr = drr[:m-1-(n-1)]
    print(sum(drr))



S = input().split(" ")
n = int(S[0])
m = int(S[1])

S = input().split(" ")

arr = list([int(s) for s in S])


calculate(n,m,arr)
# Judge status: Wrong Answer
import sys
import math

N,M=map(int,input().split())

divisor_set=set()
for i in range(1,int(math.sqrt(M))):
  if M%i==0:
    divisor_set.add(i)
    divisor_set.add(M//i)
#print(divisor_set)

divisor_list=list(divisor_set)
divisor_list.sort()

for l in divisor_list:
  if l>=N:
    answer=M//l
    print(answer)
    break
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
Money = 1000
Stock = 0
for i in range(N-1):
    if A[i] > A[i+1]:
        Money += A[i]*Stock
        Stock = 0
    else:
        Stock += Money // A[i]
        Money %= A[i]
print(Stock*A[N-1]+Money)
# Judge status: Accepted
from fractions import gcd
a,b,c,d=map(int,input().split())
m=int(c*d/gcd(c,d))
print(b-a+1-(b//c-(a-1)//c)-(b//d-(a-1)//d)+(b//m-(a-1)//m))
# Judge status: Accepted
a,b,c,k = map(int,input().split())


ka = k - a

if ka > 0:
    kb = ka - b
elif ka <= 0:
    a = k
    ka = 0
    kb = 0
else:
    kb = 0
print(a*1+ka*0+kb*-1)
# Judge status: Wrong Answer
import heapq

N,K = (int(x) for x in input().split())
H = list((-1)*(int(x)) for x in input().split())
heapq.heapify(H)

for _ in range(K):
    if len(H) == 1:
        print(0)
        break

    heapq.heappop(H)

if len(H) != 1:
    sum = 0
    for _ in range(len(H)):
        sum -= heapq.heappop(H)

    print(sum)
# Judge status: Wrong Answer
def gcd(a,b):#最大公約数を返す。Euclid
    if a<b:
        a,b=b,a
    c=a%b
    if c==0:
        return b
    return gcd(b,c)
A,B,C,D=map(int,input().split())

#nc=B//C-(A-1)//C
nc=int(B/C)-int((A-1)/C)
#nd=B//D-(A-1)//D
nd=int(B/D)-int((A-1)/D)
cd=int(C*D/gcd(C,D))
#ncd=B//cd-(A-1)//cd
ncd=int(B/cd)-int((A-1)/cd)
print(int(B-A+1-nc-nd+ncd))
# Judge status: Accepted
n = int(input())
v = sorted(map(int,input().split()))

value = v[0]
for i in range(1,n):
    value = (value + v[i]) / 2
print(value)
# Judge status: Accepted
n,m,x,y=map(int,input().split())
X=list(map(int,input().split()))
Y=list(map(int,input().split()))
mx=max(X)
my=min(Y)
if mx<my:
    for i in range(mx+1,my+1):
        if x<i<=y:
            print("No War")
            exit()
    print("War")
    
        
    

else:
    print("War")
# Judge status: Accepted
# -*- coding: utf-8 -*-

S = input().strip()

for i in reversed( range(0,len(S),2) ):
  S=S[:-2]
  if S[:int(i/2)] == S[int(i/2):] :
    print(len(S))
    break
# Judge status: Accepted
str = input()
orig = ord(str)
next = chr(orig + 1)
print(next)
# Judge status: Accepted
a,b,c = map(int,input().split())
if a % 2 == 0 and a == b == c:
    print(-1)
else:
    ans = 0
    while a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
        ab,bc,ac = a//2+b//2,b//2+c//2,a//2+c//2
        a,b,c = bc,ac,ab
        ans += 1
    print(ans)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))

b = [-1] * n
for i in range(n, 0, -1):
    cnt = sum(b[i] for i in range(i + i, n, i))
    b[i - 1] = int(a[i - 1] != cnt % 2)

print(sum(b))
if sum(b) > 0:
    print(*[i for i in b if i == 1])
# Judge status: Accepted
import collections
n=int(input())
s=[]
ans=[]
for i in range(n):
    si=input()
    s.append(si)
s_new=collections.Counter(s)
s_most=s_new.most_common()
buf=s_most[0][1]
cnt=0
for i in range(len(s_new)):
    if s_most[i][1]==buf:
        ans.append(s_most[i][0])
        cnt+=1
    elif s_most[i][1]<buf:
        break
ans_sorted=sorted(ans)
for i in range(cnt):
    print(ans_sorted[i])
# Judge status: Accepted
k, n = map(int, input().split())
a = [int(i) for i in input().split()]
ans = a[-1] - a[0]
for i in range(1,n):
    ans = min(ans, k - a[i] + a[i-1])
print(ans)
# Judge status: Accepted
def resolve():
    a, b = map(int, input().split())
    from math import ceil
    print(ceil((b - 1) / (a - 1)))


if __name__ == '__main__':
    resolve()