Harryxun/stf_run huggingface dataset:
A,B = map(int,input().split())

import math

GCD = math.gcd(A,B)

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

PF = prime_factorize(GCD)

PF = list(set(PF))

print(len(PF)+1)


### FIXED CODE ###

A,B = map(int,input().split())

import fractions

GCD = fractions.gcd(A,B)

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

PF = prime_factorize(GCD)

PF = set(PF)

res = len(PF) + 1

print(res)
s1, s2, s3 = map(int,input().split())
list = [s1,s2,s3]
a = list.count(1)
print(a)


### FIXED CODE ###

print(input().count("1"))
from scipy.special import comb  # AtCoderに出すときはspecialをmiscに変える
from collections import deque
N, K = map(int, input().split())
A = [int(x) for x in input().split()]
A = sorted(A)
B = deque()
C = deque()
for h in range(N):
    B.append(A[h])
    C.append(A[h])
mod = (10**9)+7
minlist = [0] * N
maxlist = [0] * N
ans = 0

kari = comb((N - 1), K-1, exact=True)
# print(kari)
karimod = kari % mod
ans += (karimod * B.pop()) % mod
ans -= (karimod * C.popleft()) % mod
ans = ans % mod

for i in range(1, N):
    if N - i >= K:
        if N - i == 1:
            kari = 1
        else:
            kari //= N - i
            kari *= N - i - K+1
        karimod = kari % mod
        # print(kari)
        ans += (karimod * B.pop()) % mod
        ans -= (karimod * C.popleft()) % mod
        ans = ans % mod
print(ans)


### FIXED CODE ###

from collections import deque
N, K = map(int, input().split())
A = [int(x) for x in input().split()]
A = sorted(A)
B = deque()
C = deque()
mod = (10**9)+7
for h in range(N):
    B.append(A[h])
    C.append(A[h])


def cmb(n, r):  # 【Python】組み合わせ(nCr) 計算の高速化より引用
    if (r < 0 or r > n):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod


N_cmb = 10**5
g1 = [1, 1]  # 元テーブル
g2 = [1, 1]  # 逆元テーブル
inverse = [0, 1]  # 逆元テーブル計算用テーブル

for ZZZ in range(2, N_cmb + 1):
    g1.append((g1[-1] * ZZZ) % mod)
    inverse.append((-inverse[mod % ZZZ] * (mod//ZZZ)) % mod)
    g2.append((g2[-1] * inverse[-1]) % mod)


ans = 0
for i in range(N):
    if N - i >= K:
        kari = cmb(N - i - 1, K-1) % mod
        # print(kari)
        ans += (kari * B.pop()) % mod
        ans -= (kari * C.popleft()) % mod
        ans = ans % mod
print(ans)
asdfghjkl;

### FIXED CODE ###

n,m = map(int,input().split())
print((1900*m+100*(n-m))*2**m)
#112
from itertools import product

N=int(input())
px=[]
py=[]
ph=[]

for _ in range(N):
    x,y,h=map(int,input().split())
    if h!=0:
        px.append(x)
        py.append(y)
        ph.append(h)


        
def Calc_H(Cxi,Cyj,pxi,pyj,hi):
    return hi+abs(Cxi-pxi)+abs(Cyj-pyj)

    
    
for Cxi,Cyj in product(range(101),range(101)):
    preH=Calc_H(Cxi,Cyj,px[0],py[0],ph[0])
    for i in range(1,N):
        nowH=Calc_H(Cxi,Cyj,px[i],py[i],ph[i])
        if preH!=nowH:
            break
        preH=nowH
    else:
        print(Cxi,Cyj,nowH)

### FIXED CODE ###

#111
from collections import Counter
n=int(input())
v=list(map(int,input().split()))

c0=Counter(v[0::2]).most_common()
c1=Counter(v[1::2]).most_common()

if c0[0][0]!=c1[0][0]:#再頻出の数がRとLで同一ではない場合
    ans=n-c0[0][1]-c1[0][1]
elif len(c0)!=1 and len(c1)!=1:
    ans=n-max(c0[0][1]+c1[1][1],c0[1][1]+c1[0][1])
elif len(c0)!=1 and len(c1)==1:
    ans=n-c0[1][1]-c1[0][1]
elif len(c0)==1 and len(c1)!=1:
    ans=n-c0[0][1]-c1[1][1]
elif len(c0)==1 and len(c1)==1:
    ans=n//2
print(ans)
# -*- coding:utf-8 -*-

def main():
    for i in range(int(input())):
        a=int(input())+int(input())
        if la>=10**80:
            print("overflow")
        print(a)
            
    
if __name__ == '__main__':
    main()

### FIXED CODE ###

# -*- coding:utf-8 -*-

def main():
    for i in range(int(input())):
        a=int(input())+int(input())
        if a>=10**80:
            print("overflow")
        else:
            print(a)
            
    
if __name__ == '__main__':
    main()
H, W = list(map(int, input().split()))
A = [input() for _ in range(H)]

b = "#"
w = "."

def out(i, j):
  if i < 0:
    return True
  if i >= W:
    return True
  if j < 0:
    return True
  if j >= H:
    return True
  return False

def check(i, j):
  if A[i][j] == b:
    return 0
  k = 1
  while True:
    F = False
    for ii in range(i - k, i):
      jj = j - (k - (i - ii))
      if out(ii, jj):
        continue
      if A[ii][jj] == b:
        return k
    for ii in range(i - k, i):
      jj = j + (k - (i - ii))
      if out(ii, jj):
        continue
      if A[ii][jj] == b:
        return k
    for ii in range(i, i + k + 1):
      jj = j - (k + (i - ii))
      if out(ii, jj):
        continue
      if A[ii][jj] == b:
        return k
    for ii in range(i, i + k + 1):
      jj = j + (k + (i - ii))
      if out(ii, jj):
        continue
      if A[ii][jj] == b:
        return k
    k += 1

Ans = 0
for i in range(H):
  for j in range(W):
    k = check(i, j)
    Ans = max(Ans, k)

print(Ans)

### FIXED CODE ###

H, W = list(map(int, input().split()))
A = [input() for _ in range(H)]
b = "#"
w = "."

wc = 0
L = []
wb = [[0] * W for _ in range(H)]
for i in range(H):
  for j in range(W):
    if A[i][j] == w:
      wc += 1
    else:
      L.append([i, j])
      wb[i][j] = 1

Ans = 0
while wc > 0:
  L2 = []
  Ans += 1
  for ki, kj in L:
    if ki - 1 >= 0:
      if wb[ki - 1][kj] == 0:
        wb[ki - 1][kj] = 1
        wc -= 1
        L2.append([ki - 1 , kj])
    if ki + 1 < H:
      if wb[ki + 1][kj] == 0:
        wb[ki + 1][kj] = 1
        wc -= 1
        L2.append([ki + 1 , kj])
    if kj - 1 >= 0:
      if wb[ki][kj - 1] == 0:
        wb[ki][kj - 1] = 1
        wc -= 1
        L2.append([ki, kj - 1])
    if kj + 1 < W:
      if wb[ki][kj + 1] == 0:
        wb[ki][kj + 1] = 1
        wc -= 1
        L2.append([ki, kj + 1])
  L = L2
print(Ans)
A=input("高橋君のHP:")
B=input("高橋君のATK:")
C=input("青木君のHP:")
D=input("青木君のATK:")

int_A=int(A)
int_B=int(B)
int_C=int(C)
int_D=int(D)

while True:
    int_C-=int_B
    int_A-=int_D
    if int_C<=0:
        result="YES"
        break
    if int_A<=0:
        result="NO"
        break

print(result)


### FIXED CODE ###

A,B,C,D = map(int,input().split())

while True:
    C -= B
    A -= D

    if C <= 0:
        result = "Yes"
        break
    if A <= 0:
        result = "No"
        break

print(result)
N = int(input())

ends_with_A = 0
starts_with_B = 0
both = 0

count = 0

for _ in range(N):
  s = input()
  count += s.count('AB')
  if s.endswith('A') and s.startswith('B'):
    both += 1
  elif s.endswith('A'):
    ends_with_A += 1
  elif s.startswith('B'):
    starts_with_B += 1

if ends_with_A or starts_with_B:
  print(count + both + min(ends_with_A, starts_with_B))
else:  
  print(max(count + both + min(ends_with_A, starts_with_B) - 1), 0)
  

### FIXED CODE ###

N = int(input())

ends_with_A = 0
starts_with_B = 0
both = 0

count = 0

for _ in range(N):
  s = input()
  count += s.count('AB')
  if s.endswith('A') and s.startswith('B'):
    both += 1
  elif s.endswith('A'):
    ends_with_A += 1
  elif s.startswith('B'):
    starts_with_B += 1

# 結合した文字が AXXXXXX or XXXXXXXB となるとき     
if ends_with_A + starts_with_B > 0:
  print(count + both + min(ends_with_A, starts_with_B))
else:  
  print(count + max(both - 1, 0) + min(ends_with_A, starts_with_B))
# E
import fractions
N = int(input()) 
A = list(map(int, input().split()))

def main():
    value = A[0]
    for i in range(1, N):
        value = value * A[i] // fractions.gcd(value, A[i])

    z = 10**9+7
    ans = 0
    for i in A:
        ans += (value//i) % z

    print(ans % z)

if __name__=="__main__":
    main()

### FIXED CODE ###

N = int(input()) 

ans=0
d = [10*[0] for _ in range(10)]

for i in range(1, N+1):
    s = str(i)
    if s[0]=="0" or s[-1]=="0":
        continue
    d[int(s[0])][int(s[-1])]+=1
    
for i in range(10):
    for j in range(10):
        ans+=d[i][j]*d[j][i]
print(ans)
d,n = map(int,input().split())
if d == 0 and n != 100:
    print(n)
elif d == 0 and n == 100:
    print(101)
elif d == 1 and n != 100:
    print(n*100)
elif d == 1 and n == 100:
    print(10100)
elif d == 2 and n != 100:
    print(n*10000)
elif:
    print(1010000)

### FIXED CODE ###

d,n = map(int,input().split())
if d == 0 and n != 100:
    print(n)
elif d == 0 and n == 100:
    print(101)
elif d == 1 and n != 100:
    print(n*100)
elif d == 1 and n == 100:
    print(10100)
elif d == 2 and n != 100:
    print(n*10000)
else:
    print(1010000)
#!/usr/bin/env python3
# -*- coding:utf-8 -*-

import sys

def cost(n, h):
    if n == 1:
        return 0
    elif n == 2:
        return abs(h[1]-h[0])
    else:
        ret1 = cost(n-2, h)+abs(h[n-1]-h[n-3])
        ret2 = cost(n-1, h)+abs(h[n-1]-h[n-2])
        return min(ret1, ret2)

def main():
    input = sys.stdin.readline
    N = int(input())
    H = list(map(int, input().split()))
    print(cost(N, H))

if __name__=='__main__':
    main()


### FIXED CODE ###

N = int(input())
H = list(map(int,input().split()))
DP = [0]*(N+1)  #DP[i]に来るための最小コスト
def dH(i,j):
  return abs(H[i-1] - H[j-1])
DP[2] = dH(1,2)
for i in range(3,N+1):
  DP[i] = min( DP[i-2] + dH(i-2, i) , DP[i-1] + dH(i-1, i) )
print(DP[N])
def main():
    import numpy as np
    n = int(input())
    a = np.array(list(map(int, input().split())))
    l1 = [0]*61
    mod = 10**9+7
    for cnt in range(61):
        l1[cnt] = np.sum(a%2)
        a = a // 2
    l0 = [n-i for i in l1]
    ans = 0
    for i in range(len(l1)):
        ans = (ans+l0[i]*l1[i]*pow(2, i, mod)) % mod
    print(ans)


main()


### FIXED CODE ###

def main():
    n=int(input())
    a=list(map(int,input().split()))
    l1=[0]*61
    for i in a:
        j=list(reversed(bin(i)[2:]))
        for k in range(len(j)):
            if j[k]=="1":
                l1[k]+=1
    l0=[n-i for i in l1]
    ans=0
    mod=10**9+7
    for i in range(len(l1)):
        ans=(ans+l0[i]*l1[i]*pow(2,i,mod))%mod
    print(ans)
main()
import numpy as np

H, W, M = map(int, input().split())
h = np.zeros((H))
w = np.zeros((W))
m = np.zeros((H, W))
ans = 0
for _ in range(M):
    tmp_h, tmp_w = map(int, input().split())
    h[tmp_h-1] += 1
    w[tmp_w-1] += 1
    m[tmp_h-1, tmp_w-1] = 1.

h_max = np.max(h)
h_max_index = list(zip(*np.where(h == h_max)))
w_max = np.max(w)
w_max_index = list(zip(*np.where(w == w_max)))

for i in h_max_index:
    for j in w_max_index:
        if m[i[0]][j[0]] == 1.:
            tmp = h_max + w_max -1
        else:
            tmp = h_max + w_max
        if ans < tmp:
            ans = tmp
print(int(ans))


### FIXED CODE ###

import numpy as np

H, W, M = map(int, input().split())
h = np.zeros(H)
w = np.zeros(W)
m = {}
flag = 0

for _ in range(M):
    tmp_h, tmp_w = map(int, input().split())
    h[tmp_h-1] += 1
    w[tmp_w-1] += 1
    m[(tmp_h-1, tmp_w-1)] = 1.

h_max = np.max(h)
h_max_index = list(zip(*np.where(h == h_max)))
w_max = np.max(w)
w_max_index = list(zip(*np.where(w == w_max)))

for i in h_max_index:
    for j in w_max_index:
        if (i[0], j[0]) not in m.keys():
            flag = 1
            break

if flag == 1:
    print(int(h_max + w_max))
else:
    print(int(h_max + w_max - 1))
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

N = I()

MAX = 10**18
result = 1
for i in input().split():
    result *= i

if result > MAX:
    print(-1)
else:
    print(result)

### FIXED CODE ###

from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

N = I()

MAX = 10**18
result = 1
A = FLI()
if 0 in A:
    print(0)
    exit()
    
for i in A:
    result *= int(i)
    if result > MAX:
        print(-1)
        exit()

print(result)
price = [int(x) for x in input().split()];
N = int(input());
price_d = price[3];
price_s = 2*price[2];
price_h = 4*price[1];
price_q = 8*price[0];
p = min([price_q,price_h,price_s]);
if price_d < p :
    if N%2 == 1 :
        ans = (N-1)//2*price_d + p//2;
    else :
        ans = N//2*price_d;
else :
    ans = N*p//2;

print(ans));



### FIXED CODE ###

price = [int(x) for x in input().split()];
N = int(input());
price_d = price[3];
price_s = 2*price[2];
price_h = 4*price[1];
price_q = 8*price[0];
p = min([price_q,price_h,price_s]);
if price_d < p :
    if N%2 == 1 :
        ans = (N-1)//2*price_d + p//2;
    else :
        ans = N//2*price_d;
else :
    ans = N*p//2;

print(ans);
inputs = input().split()

if -100 <= input[0] and input[1] <= 100:
	print(max([input[0]+input[1], input[0]-input[1], input[0]*input[1]]))
else:
	raise ValueError
  
  

### FIXED CODE ###

inputs = input().split()
a      = int(inputs[0])
b      = int(inputs[1])
if -100 <= a and b <= 100:
	print(max([a+b, a-b, a*b]))
else:
	raise ValueError
n=input()
maxn=0
maxcount=0
 
for i in range(n+1):
  count=0
  now=i
  while n%2==0:
    now=now/2
    count+=1
  if maxcount < count:
    maxn=now
    maxcount=count
 
print(maxn)

### FIXED CODE ###

n=int(input())
i=1
while i*2<=n:
  i*=2
print(i)
S=str(input())
letter="ABCDEFGHIJKLMNO"
condition1 = S[0]=='A'
condition2 = len([1 for x in S[2:len(S)-1] if x=="C"]) == 1
condition3 = len([1 for x in S if len([1 for y in letter if y>10])==1]) == 2
if condition1 & condition2 & condition3:
  print('AC')
else:
  print('WA')

### FIXED CODE ###

S=str(input())
letter="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
condition1 = S[0]=='A'
condition2 = len([1 for x in S[2:len(S)-1] if x=="C"]) == 1
count=0
for i in range(len(S)):
  if len([1 for x in letter if x==S[i]]) == 1:
    count = count + 1
condition3 = count == 2
if condition1 & condition2 & condition3:
  print('AC')
else:
  print('WA')
import math

a,b,c,d =map(int,input().split())
e = (c*d)//math.gcd(c,d)
ac = a//c   
if a % c == 0:
    ac-=1
bc = b//c 

ad=a//d 
if a % d == 0:
    ad-=1
bd= b//d


acd = a//e 
if a % e == 0:
    acd-=1
bcd= b//e 


count = b-a+1
count -= bc-ac
count -= bd-ad
count += bcd-acd

print(count)
##print(e)
#print(bcd-acd)
#print(bd-ad)
#print(bc-ac)


### FIXED CODE ###

def gcd(a,b):
    while b:
        a,b = b,a%b
    return a

a,b,c,d =map(int,input().split())
e = (c*d)//gcd(c,d)
ac = a//c   
if a % c == 0:
    ac-=1
bc = b//c 

ad=a//d 
if a % d == 0:
    ad-=1
bd= b//d


acd = a//e 
if a % e == 0:
    acd-=1
bcd= b//e 


count = b-a+1
count -= bc-ac
count -= bd-ad
count += bcd-acd

print(count)
##print(e)
#print(bcd-acd)
#print(bd-ad)
#print(bc-ac)
import re

s = input().replace('?', '.')
t = input()

for i in range(len(s)-len(t)+1):
  check_str = s[len(s)-len(t)-i:len(s)-i]
  if re.match(check_str, t):
    break

if i==len(s)-len(t):
  print('UNRESTORABLE')
else:
  ans = s[:len(s)-len(t)-i] + t + s[len(s)-i:]
  ans = ans.replace('.', 'a')
  print(ans)

### FIXED CODE ###

import re

s = input().replace('?', '.')
t = input()

if len(t)>len(s):
  print('UNRESTORABLE')
elif len(t)==len(s):
  if re.match(s, t):
    print(t)
  else:
    print('UNRESTORABLE')
else:
  for i in range(len(s)-len(t)+1):
    check_str = s[len(s)-len(t)-i:len(s)-i]
    if re.match(check_str, t):
      break

  if i==len(s)-len(t):
    print('UNRESTORABLE')
  else:
    ans = s[:len(s)-len(t)-i] + t + s[len(s)-i:]
    ans = ans.replace('.', 'a')
    print(ans)
# coding: utf-8
# Your code here!

n,m = map(int,input().split())
a = [-1 for i in range(n)]
flag = 1
for i in range(m):
    b,c = map(int,input().split())
    b -= 1
    if a[b] != -1 and a[b] != c:
        flag = 0
        print("-1")
        break
    else:
        a[b] = c

if flag == 1:
    if a[0] == 0:
        if n == 1:
            print(0)
        else:
            print(-1)
    else:
        if a[0] == -1:
            a[0] = 1:
        ans = 0
        for i in range(n):
            if a[i] != -1:
                ans += a[i] * (10**(n-1-i))
        print(ans)

### FIXED CODE ###

# coding: utf-8
# Your code here!

n,m = map(int,input().split())
a = [-1 for i in range(n)]
flag = 1
for i in range(m):
    b,c = map(int,input().split())
    b -= 1
    if a[b] != -1 and a[b] != c:
        flag = 0
        print("-1")
        break
    else:
        a[b] = c

if flag == 1:
    if a[0] == 0:
        if n == 1:
            print(0)
        else:
            print(-1)
    else:
        if a[0] == -1:
            if n == 1:
                a[0] = 0
            else:
                a[0] = 1
        ans = 0
        for i in range(n):
            if a[i] != -1:
                ans += a[i] * (10**(n-1-i))
        print(ans)
# -*- coding:utf-8 -*-

x = input()
a = x[0]
b = x[2]

area = int(a) * int(b)
length = int(a)*2 + int(b)*2

print(area,length)

### FIXED CODE ###

# -*- coding:utf-8 -*-

x = input()
k = x.split(' ')
a = int(k[0])
b = int(k[1])

area = int(a) * int(b)
length = int(a)*2 + int(b)*2

print(area,length)
import sys
import time
import random
sys.setrecursionlimit(100000000)
N, A, B = map(int, input().split())
sTime = time.time()

P = [-1] * N
Q = [0] * (2**N)
X = [0] * (2**N)
X[0] = 1
X[1] = 1
Y = [1<<i for i in range(N)]
Z = [0]

def calc(k, l, M):
    aa = 0
    bb = 0
    done = [0] * N
    for i in range(M):
        # print("M, i, k,aa,Y=", M, i, k, aa, Y)
        while k & Y[aa] == 0:
            aa += 1
        while l & Y[bb] == 0:
            bb += 1
        P[aa] = bb
        done[bb] = 1
        aa += 1
        bb += 1
    j = 0
    # print(P)
    # print(done)
    for i in range(N):
        if P[i] >= 0:
            continue
        while done[j] == 1:
            j += 1
        P[i] = j
        j += 1

def change(n):
    ret = 0
    for i in range(N):
        if n & (1<<i):
            ret += 1<<P[i]
    return ret

def dc(n):
    return sum(map(int, list(bin(n)[2:])))


def dfs(n, c):
    if time.time() - sTime > 1.75:
        return -1
    for i in range(N):
        m = n ^ Y[i]
        # print(n, i, m, c)
        if c == 2**N - 2 and m == 1:
            X[m] = 1
            Z.append(m)
            return 1
        if X[m] == 0 and m != 1:
            X[m] = 1
            Z.append(m)
            # print(Z)
            r = dfs(m, c+1)
            if r:
                return r
            if r < 0:
                return -1
            X[m] = 0
            Z.pop()
    return 0

if (dc(A) + dc(B)) % 2 == 0:
    print("NO")
else:
    r = dfs(0, 0)
    for i in range(2**N):
        if Z[i] == A:
            Z = Z[i:] + Z[:i]
    # print(X, Y, Z)
    if r < 0:
        print("NO")
    else:
        # print("A", Z[:10], Z[-10:])
        mi = 99999
        while mi > 0:
            # for i in range(3, 2**N-1, 2):
            i = random.randrange(max(2**N-1001, 1),2**N-1,2)
            if Z[i-1]^Z[-1] in Y:
                Z = Z[:i] + Z[i:][::-1]
                mi = abs(dc(Z[-1]) - dc(B))
        # print("A", Z[:10], Z[-10:])
        # print("(Z[-1], B, dc(B))", Z[-1], B, dc(B))
        calc(Z[-1], B, dc(B))
        # print("P=", P)
        for i in range(N):
            s = 1<<P[i]
            t = 1<<i
            for j in range(2**N):
                if j & t:
                    Q[j] += s
        Z = [Q[z] for z in Z]
        # print(Z[:10], Z[-10:])
        print("YES")
        print(*Z)
            
        

### FIXED CODE ###

def dc(n):
    return sum(map(int, list(bin(n)[2:])))
def calc(a, b, X):
    if len(X) == 1:
        return [a, b]
    i = 0
    while i not in X or (a & (1<<i)) == (b & (1<<i)):
        i += 1
    j = X[1] if i == X[0] else X[0]
    Y = [x for x in X if x != i]
    return calc(a, a ^ (1<<j), Y) + calc(a ^ (1<<j) ^ (1<<i), b, Y)

N, A, B = map(int, input().split())
if dc(A^B) % 2 == 0:
    print("NO")
else:
    print("YES")
    print(*calc(A, B, list(range(N))))
N = int(input())
A = [int(_) for _ in input().split()]
colors = [0] * 9
for a in A:
    c = a // 400
    if c < 8:
        colors[c] = 1
    else:
        colors[c] += 1
print(max(sum(colors[:8]), 1), min(sum(colors[:8]) + colors[8], 8))

### FIXED CODE ###

N = input()
a = input().split()
scores = [0,0,0,0,0,0,0,0]
score8 = 0
for i in a:
    check = int(int(i) / 400)
    if check > 7:
        score8 += 1
    else:
        scores[check] = 1
score1to7 = sum(scores)
saidai = score1to7 + score8
if score1to7 < 1:
    saisho = 1
else:
    saisho = score1to7
print(str(saisho) + " " + str(saidai))
import copy

def main():
    def gcd(a, b):
        if b == 0:
            return a
        else:
            return gcd(b, a%b)

    def lcm(a, b):
        return int(a / gcd(a, b)) * b
    
    n, m = map(int, input().split())
    A = set([int(x) for x in input().split()])
    A_ = copy.deepcopy(A)
    a_ = A.pop()
    for a in A:
        a_lcm = lcm(a_, a)
        a_ = a_lcm
    for i in A_:
        if a_lcm / 2 % 2 == 0:
            print(0)
            exit()
    if a_lcm / 2 > m:
        print(0)     
    else:
        ans = int((m - (a_lcm / 2))) // a_lcm + 1
        print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import copy
# from math import gcd


def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

def lcm(a, b):
    return (a // gcd(a, b)) * b
def main():
    n, m = map(int, input().split())
    A = set([int(x) for x in input().split()])
    a_lcm = 1
    for a in A:
        a_lcm = lcm(a_lcm, a)
        # mがlcmの半分よりも小さかったら0
        if (a_lcm / 2) > m:
            print(0)
            exit()
    for a in A:
        if (a_lcm / 2) % a == 0:
            print(0)
            exit()
    # # あとは定数倍の数調べて終わり
    ans = int((m - (a_lcm / 2)) // a_lcm) + 1
    print(ans)

if __name__ == '__main__':
    main()
a,b = map(int, input().split())

if num (a*b) % 2 == 0:
  print(Even)
  
else:
  print(Odd)

### FIXED CODE ###

a,b = map(int, input().split())
 
if (a*b)%2 == 0:
  print("Even")
  
else:
  print("Odd")
N, K = map(int,input().split())
S = input()
if S[K - 1] == 'A':
  S[K - 1] = 'a'
elif S[K - 1] == 'B':
  S[K - 1] = 'b'
else:
  S[K - 1] = 'c'
print(S)

### FIXED CODE ###

N, K = map(int, input().split())
S = list(input())

if S[K - 1] == 'A':
    S[K - 1] = 'a'
elif S[K - 1] == 'B':
    S[K - 1] = 'b'
else:
    S[K - 1] = 'c'

ans = ''.join(S)
print(ans)
N = int(input())
d = [int(x) for x in input().split()]

d.sort()
length = len(d)
left = d[length//2-1]
right = d[length//2]

if left==right:
    print(0)
else:
    print(ans)

### FIXED CODE ###

N = int(input())
d = [int(x) for x in input().split()]

d.sort()
length = len(d)
left = d[length//2-1]
right = d[length//2]

if left==right:
    print(0)
else:
    print(right - left)
import math
from functools import reduce


def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)



n = int(input())

l = list(map(int, input().split()))

lcm = lcm_list(l)
a = lcm-1
mod_all = 0

for i in l:
    mod_all += a%i

print(mod_all)



### FIXED CODE ###

import math
from functools import reduce
import fractions

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)



n = int(input())

l = list(map(int, input().split()))

lcm = lcm_list(l)
a = lcm-1
mod_all = 0

for i in l:
    mod_all += a%i

print(mod_all)