Harryxun/stf_run huggingface dataset:
A,B,C,D=map(int,input().split())
if A <= C and C <= B and B <= D:
  print(B-C)
elif C <= A and A <= B and B <= D:
  print(B-A)
elif A <= B and B <= C and C <= D:
  print(0)
elif C <= A and A <= D and D <= B:
  print(D-A)
elif A <= C and C <= D and D <= B:
  print(D-C)
else C <= D and D <= A and A <= B:
  print(0)

### FIXED CODE ###

A,B,C,D=map(int,input().split())
if A <= C and C <= B and B <= D:
  print(B-C)
elif C <= A and A <= B and B <= D:
  print(B-A)
elif A <= B and B <= C and C <= D:
  print(0)
elif C <= A and A <= D and D <= B:
  print(D-A)
elif A <= C and C <= D and D <= B:
  print(D-C)
elif C <= D and D <= A and A <= B:
  print(0)
S = input()
T = input()

for i in range(len(S)-1):
    if S == T:
        print('Yes')
        exit()
    x = S[-1]
    S = list(S)
    S.pop(-1)
    S.insert(0,x)
    S = ''.join(S)


print('No')

### FIXED CODE ###

A,B,C = map(int, input().split())
num_list = [A,B,C]
num_sorted_list = sorted(num_list)
print(num_sorted_list[1]-num_sorted_list[0] + num_sorted_list[2]-num_sorted_list[1])
n, m = map(int, input().split())
print(n * (n-1) // 2 + m * (m-1) // 2)

### FIXED CODE ###

n, m = map(int, input().split())
print(n * (n - 1) // 2 + m * (m -1) // 2)
a = input()
b = input()
count = 0
for i in renge(3):
	if a[i] == b[i]:
    	count += 1
print(count)


### FIXED CODE ###

a = str(input())
b = str(input())
count = 0
for i in range(3):
	if a[i] == b[i]:
		count += 1
        
print(count)
n = int(input())
in_num = input().split()
lis_num = [int(s) for s in in_num]
m = max(lis_num)

x = [lis_num[i] % m for i in range(n)]
sx = max(x.remove(max(x)))
m2 = max(lis_num.remove(m))
y = [lis_num[i] % m2 for i in range(n)]
sy = max(y.remove(max(y)))
if sx == 0:
  ans = m
elif sy == 0:
  ans = m2
else:
  for i in range((m+1)//2, 0, -1):
    x = [lis_num[j] % i for j in range(n)]
    sx = max(x.remove(max(x)))
    if sx == 0:
      ans = i
      break
    else:
      continue
print(ans)


### FIXED CODE ###

a, b, t = map(int, input().split())
 
hmb = b * (t // a)
print(hmb)
H,W = map(int, input().split())
As = []
for i in range(H):
    As.append(list(map(int, input().split())))
diffs = []
for i in range(H):
    bs = list(map(int, input().split()))
    diffs.append([a-b for a,b in zip(As[i],bs)])
import numpy as np 
M = np.array(diffs).max()*(H+W)

# print(M)
# (i,j)において、偏りがkになることがあるか
diff_s = abs(diffs[0][0])
# 初期値
dp = [[[False]*M for i in range(W)] for j in range(H)]
dp[0][0][diff_s] = True
# もらうDP
for i in range(H):
    for j in range(W):
        # 行方向
        if i+1 < H:
            d = abs(diffs[i+1][j])
            for k in range(M):
                x = dp[i][j][k]
                if x:
                    dp[i+1][j][d+k] = x
                    dp[i+1][j][abs(d-k)] = x
        # 列方向
        if j+1 < W:
            d = abs(diffs[i][j+1])
            for k in range(M):
                x = dp[i][j][k]
                if x:                
                    dp[i][j+1][d+k] = x
                    dp[i][j+1][abs(d-k)] = x
        # print(i,j,diffs[i][j],dp)

ans = 0
for i,b in enumerate(dp[i][j]):
    if b:
        print(i)
        exit()

### FIXED CODE ###

M = 6400*4
mid = M//2
INF = 10**18

H,W = map(int, input().split())
As = []
for i in range(H):
    As.append(list(map(int, input().split())))
diffs = []
for i in range(H):
    bs = list(map(int, input().split()))
    diffs.append([abs(a-b) for a,b in zip(As[i],bs)])

# bitset高速化
# 初期値
dp = [[0]*W for j in range(H)]
dp[0][0] = 1 << (mid+diffs[0][0]) #プラスマイナス考慮して、下駄をはかせる
for i in range(H):
    for j in range(W):
        # 行方向
        if i+1 < H:
            d = diffs[i+1][j]
            dp[i+1][j] |= dp[i][j] >> d  
            dp[i+1][j] |= dp[i][j] << d  
        # 列方向
        if j+1 < W:
            d = diffs[i][j+1]
            dp[i][j+1] |= dp[i][j] >> d
            dp[i][j+1] |= dp[i][j] << d

ans = INF
for i in range(M):
    if dp[H-1][W-1] >> i & 1:
        # print(i-mid)
        ans = min(ans, abs(i-mid))
print(ans)
s=list(map(str,input()))
#print(s)
s_3=[]
for i in range(len(s)-2):
  a=''.join(s[i:(i+3)])
  #print(a)
  s_3.append(abs(int(a)-753))
print(min(s_3))

### FIXED CODE ###

a=int(input())
if(a==3 or a==5 or a==7):
  print('YES')
else:print('NO')
W=input()
T=[]
while 1:
 a=input()
 if'END_OF_TEXT '==a:break
 T+=[s.lower() for s in a.split()]
print(T.count(W))

### FIXED CODE ###

import sys
W=input()
print(sys.stdin.read().lower().split().count(W))
N = int(input() )
S, T = map(str, input().split())
print(S + T

### FIXED CODE ###

N = int(input() )
S, T = map(str, input().split())

newword = []
for num in range(len(S)):
    newword.append(S[num])
    newword.append(T[num])
word = ""
for i in newword:
    word+=i
print(word)
import numpy as np


a = input()

part = ""
s = ["A","C","G","T"]
ans = []

for i in a:
    if  i not in s:
        ans.append(part)
        part = ""
    else:
        part += i


print(len(max(ans)))

### FIXED CODE ###

a = input()

part = ""
s = ["A","C","G","T"]
ans = [""]

for i in a:
    
    if  i  in s:
        part += i
    else:
        part = ""
    ans.append(part)
ans = [len(i) for i in ans]
print(max(ans))
inp_list = input().spilt()
if inp_list[0] / inp_list[1] <= 80:
    print("Yes") 
else:
    print("No")

### FIXED CODE ###

inp = input()
inp_list = inp.split()
inp_list = [int(i) for i in inp_list] 
if inp_list[0] / inp_list[1] <= inp_list[2]:
    print("Yes") 
else:
    print("No")
n = int(input())
print(" ".join(input().split()).reveres())

### FIXED CODE ###

n = int(input())
print(" ".join(input().split()[::-1]))
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())
a=list(map(int,input().split()))
aa=lcm_list(a)
ans=0
for i in a:
  ans+=aa//i
ans=aa//ans
print(ans)

### FIXED CODE ###

import fractions as fr
from functools import reduce

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

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

n=int(input())
a=list(map(int,input().split()))
aa=lcm_list(a)
ans=0
for i in a:
  ans+=aa//i
ans=aa/ans
print(ans)
N = int(input())
A = list(map(lambda a : int(a), input().split(" ")))
ans = 1
print i in range(len(A)):
  ans *= A[i]

print(ans) if ans <= 10 ** 18 else print("-1")

### FIXED CODE ###

N = int(input())
A = list(map(lambda a : int(a), input().split(" ")))
ans = 1
if A.count(0) > 0:
  ans = 0

for i in range(len(A)):
  ans *= A[i]
  if ans > 10 ** 18:
    ans = -1
    print("-1")
    break
 
if ans != -1:
  print(ans)
n = int(input())
p = list(map(input().split()))
i = 1
cnt = 0
while i < len(p):
  if p[i] > p[i - 1] and p[i] < p[i + 1] :
    cnt += 1
  i += 1

### FIXED CODE ###

n = int(input())
p = list(map(int, input().split()))
i = 1
cnt = 0
while i < len(p) - 1:
  l = sorted([p[i - 1], p[i], p[i + 1]])
  if l[1] == p[i]:
    cnt += 1
  i += 1
print(cnt)
alfa=input()
N=int(alfa[0])
X=int(alfa[2])
#L=[int(input().split()) for i in range(N)]
L=input().split()


#print(N,X,L)
D=0
count=1
for i in range(N-1):
    D+=int(L[i])
    if D>X:
        print(count)
        break
    else:
        count+=1


### FIXED CODE ###

alfa=input().split()
N=int(alfa[0])
X=int(alfa[1])
#L=[int(input().split()) for i in range(N)]
L=input().split()

#print(N,X,L)
D=0
count=1
for i in range(N):
    D+=int(L[i])
    if D>X:
        print(count)
        break
    else:
        count+=1

if D<=X:
    print(count)
α = (input())
if α = A or B or C or D or E or F or G or H or I or J or K or L or M or N or O or P or Q or R or S or T or U or V or W or X or Y or Z:
    print('A')
else:
    print('a')

### FIXED CODE ###

α = input()
if α in['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']:
    print('A')
else:
    print('a')
a=input()
b=0
for i while(4)
    if a[i]=="+":
        b+=1
    else:
        b-=1
print(b)

### FIXED CODE ###

a=input()
b=0
for i in range(4):
    if a[i]=="+":
        b+=1
    else:
        b-=1
print(b)
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

U = 10**6 + 10

def main(A, primes):
    B = np.zeros(U + 1, np.int64)
    for x in A:
        B[x] += 1
    for p in primes:
        for i in range(U // p + 1):
            B[p * i] += B[i]
    ret = 0
    for x in A:
        ret += B[x] == 1
    return ret

if sys.argv[-1] == 'ONLINE_JUDGE':
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('main', '(i8[::1],i8[::1])')(main)
    cc.compile()
    exit()
from my_module import main

def prime_table(N):
    is_prime = np.zeros(N, np.int64)
    is_prime[2:3] = 1
    is_prime[3::2] = 1
    for p in range(3, N, 2):
        if p * p >= N:
            break
        if is_prime[p]:
            is_prime[p * p::p + p] = 0
    return is_prime, np.where(is_prime)[0]

A = np.array(read().split(), np.int64)[1:]
_, primes = prime_table(U)

print(solve(A, primes))

### FIXED CODE ###

import sys
import numpy as np
from numba import njit

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

@njit('(i4[::1],)', cache=True)
def solve(A):
    count = np.zeros(10**6 + 10, np.int32)
    for x in A:
        if count[x] > 1:
            continue
        count[::x] += 1
    ret = 0
    for x in A:
        ret += count[x] == 1
    return ret

A = np.array(read().split(), np.int32)[1:]

print(solve(A))
N = int(input())

D = []
for i in range(N):
    D.append(list(map(int,input().split())))

for i in range(N):
    if D[i][0] == D[i][1] and D[i+1][0] == D[i+1][1] and D[i+2][0] == D[i+2][1]:
        ans = "Yes"
    else:
        ans = "No"
print(ans)

### FIXED CODE ###

N = int(input())

D = []
for i in range(N):
    Da,Db = (map(int,input().split()))
    if Da == Db:
        D.append(1)
    else:
        D.append(0)

for i in range(N-2):
    if D[i]==1 and D[i+1] == 1 and D[i+2] == 1:
        ans = "Yes"
        break
    else:
        ans = "No"
print(ans)
n = int(input())

a = [int(x) for x in input().split() if x != "1"]

sum = a[0]

for i in range(1,len(a)):
    sum = sum * a[i]
    if 0 in a:
        sum = 0
        break
    elif sum > 10**18:
        break
    


if sum > 10**18:
    print(-1)
else:
    print(sum)

### FIXED CODE ###

n = int(input())

a = [int(x) for x in input().split() ]
sum = a[0]

if 0 in a:
        sum = 0
else:
    for i in range(1,len(a)):
        sum = sum * a[i]
        if sum > 10**18:
            break
        


if sum > 10**18:
    print(-1)
else:
    print(sum)
S = input().split()
T = input().split()
ans = 0
for i in range(3):
  if S[i] == T[i]:
    ans += 1

print(ans)

### FIXED CODE ###

S = input()
T = input()

sl = []
tl = []
ans = 0
for s in S:
  sl.append(s)

for t in T:
  tl.append(t)

for i in range(3):
  if sl[i] == tl[i]:
    ans += 1
print(ans)
a,b=input().split()
a=int(a)
b=int(100*b)
print((a*b)/100)

### FIXED CODE ###

a,b=input().split()
a=int(a)
b=(100*float(b)+0.05)
print(a*int(b)//100)
s = list(map(int, list(input())))
ans = n
for i in range(len(s)-1):
    if s[i]!=s[i+1]:
        ans = min(ans, max(i+1, len(s)-i-1))
print(ans)


### FIXED CODE ###

s = list(map(int, list(input())))
ans = len(s)
for i in range(len(s)-1):
    if s[i]!=s[i+1]:
        ans = min(ans, max(i+1, len(s)-i-1))
print(ans)
H,N = map(int,input().split())

AB = []

for i in range(N):
    a,b = map(int,input().split())
    AB.append([a,b])

dp = [0]*(H+1)

for i in range(H+1):
    dp[i] = min(dp[i-a]+b for a,b in AB)
    
print(dp[H-1])

### FIXED CODE ###

H,N = map(int,input().split())
AB = [list(map(int, input().split())) for i in range(N)]

M = max(a for a,b in AB)

dp = [0]*(H+M)

for i in range(1,H+M):
    dp[i] = min(dp[i-a]+b for a,b in AB)
    
print(min(dp[H:]))
s = input()
n = input()
ans = 0
for i in range(n):
  if s[0] == n[i]:
    ans += 1
print(ans)
  
  

### FIXED CODE ###

s = input()
n = input()
ans = 0
for i in range(3):
  if s[i] == n[i]:
    ans += 1
print(ans)
a=int(input())
b=int(input())

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

### FIXED CODE ###

a,b=map(int,input().split())
c=(a*b)%2
if c==0:
    print("Even")
else:
    print("Odd")
n=int(input())
if n%2==0:print(n)
else print(n*2)

### FIXED CODE ###

n=int(input())
if n%2==0:
    print(n)
else:
    print(n*2)
n,k,q = map(int,input().split(' '))
ans = [k-q]*n
i = 0
while i < q:
    p = int(input())
    ans[p] += 1
    i += 1
str = ''
for a in ans:
    if a > 0:
        str += 'Yes\n'
    else:
        str += 'No\n'
print(str)

### FIXED CODE ###

n,k,q = map(int,input().split(' '))
ans = [k-q]*n
i = 0
while i < q:
    p = int(input())
    ans[p-1] += 1
    i += 1
str = ''
for a in ans:
    if a > 0:
        str += 'Yes\n'
    else:
        str += 'No\n'
print(str)
S = str(input())
S[3]="8"
print(S)

### FIXED CODE ###

S = str(input())
print(S[0:3]+"8"+S[4:])
#!/usr/bin/env python3
#ABC100 D

from itertools import *

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

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

pm = (1,-1)

ans = -1
for a in product(*[pm] *3):
    cakes.sort(key = lambda y:sum(list(map(lambda x: x[0]*x[1],zip(a,y)))))
    x,y,z = zip(*cakes[:M])
    ans = max(ans,abs(sum(x))+abs(sum(y))+abs(sum(z)))
print(ans)


### FIXED CODE ###

#!/usr/bin/env python3
#ABC100 D

from itertools import *

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

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

pm = (1,-1)
if M == 0:
    print(0)
else:
    ans = -1
    for a in product(*[pm] *3):
        cakes.sort(key = lambda y:sum(list(map(lambda x: x[0]*x[1],zip(a,y)))))
        x,y,z = zip(*cakes[:M])
        ans = max(ans,abs(sum(x))+abs(sum(y))+abs(sum(z)))
    print(ans)
import numpy as np

S = input()
s = len(S)
shift = 10**100
K = shift.bit_length()

ini_ad = np.array([1 if i == "R" else -1 for i in S])

def db(A:list, k:int):
    dv = np.array([[0]*s for _ in range(k+1)])
    dv[0] = A
    for kk in range(1,k+1):
        for n in range(s):
            dv[kk][n] = dv[kk-1][dv[kk-1][n]]
    return dv[k]

a = list(range(s))+ini_ad
for i in range(1,K):
    if (shift >> i)&1:
        a = db(ans, i)
ans = [0]*s
for j in a:
    ans[j]+=1
print(*ans)

### FIXED CODE ###

LOG = 18

def main():
    S = input()
    N = len(S)
    to = []
    for _ in range(LOG):
        l = [0]*N
        to.append(l)
        
    for i in range(N):
        to[0][i] = i + 1 if S[i] == "R" else i -1
    
    for i in range(1, LOG):
        for j in range(N):
            to[i][j] = to[i-1][to[i-1][j]]
            
    ans = [0]*N
    for j in range(N):
        ans[to[LOG-1][j]] += 1
        
    print(*ans)
    return

main()
import sys
a= str(input())
kaibun = list(a)
n = int(len(kaibun))
answer = "No"
strongn1 = int((n-1)/2)
strongn2 = int((n+3)/2)
for i in reversed(range((int((n+1)/2)),n)):
    if kaibun[i] == kaibun[n-i-1]:
        answer = "Yes"
    else:
        answer = "No"
        print(answer)
        sys.exit()
for i in range(int(strongn1/2)):
    if kaibun[i] == kaibun[strongn1-i-1]:
        answer = "Yes"
    else:
    	answer="No"
    	print(answer)
    	sys.exit()
for i in reversed(range(strongn2,n,int(strongn1/2))):
    print(i)
    print(strongn2-2-i+n)
    if kaibun[i] == kaibun[strongn2-2-i+n]:
        answer = "Yes"
    else:
      	answer = "No"
print(answer)

### FIXED CODE ###

a= str(input())
kaibun = list(a)
n = int(len(kaibun))
answer = "No"
strongn1 = int((n-1)/2)
strongn2 = int((n+3)/2)
for i in reversed(range((int((n+1)/2)),n)):
    if kaibun[i] == kaibun[n-i-1]:
        answer = "Yes"
    else:
        answer = "No"
        break

if answer == "Yes":
    for i in range(int(strongn1/2)):

        if kaibun[i] == kaibun[strongn1-i-1]:
            answer = "Yes"
        else:
            answer="No"
            break
if answer == "Yes":
    for i in reversed(range(strongn2+int(strongn1/2)-1,n)):
        if kaibun[i] == kaibun[strongn2-2-i+n]:
            answer = "Yes"
        else:
            answer = "No"
            break
print(answer)
N=input()
if len(n)>1:
  N=N[1]
  
if N in ["2","4","5","7","9"]:
  print("hon")
elif N == "3":
  print("bon")
else:
  print("pon")

### FIXED CODE ###

N=str(input())
N=N[-1]
  
if N in ["2","4","5","7","9"]:
  print("hon")
elif N == "3":
  print("bon")
else:
  print("pon")
from scipy.sparse.csgraph import csgraph_from_dense
from scipy.sparse.csgraph import floyd_warshall
N,M,L=map(int,input().split())
ABC=[map(int,input().split()) for _ in range(M)]
Q=int(input())
ST=[list(map(int,input().split())) for _ in range(Q)]

E=[[float('inf')]*N for _ in range(N)]
for a,b,c in ABC:
    E[a-1][b-1]=c
    E[b-1][a-1]=c
G = csgraph_from_dense(E, null_value=10**10)
d = floyd_warshall(G)
E=[[1 if __<= L else 10**10 for __ in _] for _ in d]
G = csgraph_from_dense(E, null_value=10**10)
E = floyd_warshall(G)

for s,t in ST:
    if E[s-1][t-1]==float('inf'):
        print(-1)
    else:
        print(int(E[s-1][t-1]-1))

### FIXED CODE ###

from scipy.sparse.csgraph import csgraph_from_dense
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall
import numpy as np
N,M,L=map(int,input().split())
A=[0]*M
B=[0]*M
C=[0]*M
for i in range(M):
    A[i],B[i],C[i] = map(int,input().split())
    A[i] -=1
    B[i] -=1
Q=int(input())
ST=[list(map(int,input().split())) for _ in range(Q)]


G = csr_matrix((C, (A, B)), shape=(N, N))
d = floyd_warshall(G, directed=False)
G=np.full((N,N), np.inf)
G[d<=L]=1
G = csr_matrix(G)
E = floyd_warshall(G, directed=False)

for s,t in ST:
    if E[s-1][t-1]==float('inf'):
        print(-1)
    else:
        print(int(E[s-1][t-1]-1))
import sys

N = int(sys.stdin.readline().rstrip())
S = sys.stdin.readline().rstrip()
Q = int(sys.stdin.readline().rstrip())
k = [int(x) for x in sys.stdin.readline().rstrip().split(' ')]

def counter(S, ki):
  count = 0
  for i in range(0, len(S)): 
    for j in range( i+2, len(S)):
      if j - i <=1 or j - i >= ki:
        continue
      for l in range(i+1, j):
        if (S[i], S[l], S[j]  ) == ('D', 'M', 'C'):
          count += 1
  return count
  
for ki in k:
  print(counter(S, ki))

### FIXED CODE ###

import sys
N = int(sys.stdin.readline().rstrip())
a = [int(x) for x in sys.stdin.readline().rstrip().split(' ')]
d = [abs(sum(a)/float(N) - ai) for ai in a]

if len(set(d))==1:
  print(0)
else:
  print(d.index(min(d)))
n, w = map(int, input().split())
import numpy as np
dp = np.zeros((n+1, w+1), np.int64)
for i in list(range(n+1))[1:]:
    wi, vi = map(int, input().split())
    dp[i] = [max(dp[i-1][j], dp[i-1][j-wi]+vi) if j >= wi else dp[i-1][j] for j in range(w+1)]
print(max(dp[-1]))

### FIXED CODE ###

n, w = map(int, input().split())
import numpy as np
dp = np.zeros(w+1, np.int64)
for i in range(n):
    wi, vi = map(int, input().split())
    np.maximum(dp[:-wi]+vi, dp[wi:], out=dp[wi:])
print(max(dp))
n, a, b = (int(i) for i in input().split())
count = 0
for i in range(1, n):
    res = sum([int(j) for j in str(i)])
    if(a <= res && res <= b):
       count = count + 1
print(count)

### FIXED CODE ###

n, a, b = (int(i) for i in input().split())
result = 0
for i in range(1, n + 1):
    res = sum([int(j) for j in str(i)])
    if(a <= res & res <= b):
        result = result + i
print(result)
number_of_guests = input().split()

A = int(number_of_guests[0])
B = int(number_of_guests[1])


A_divisors = []
x = 2
while True:
    if (A % x == 0):
        A /= x
        A_divisors.append(x)
    else:
        x += 1

    if (A <= 1):
        break

y = 2
B_divisors = []
while True:
    if (B % y == 0):
        B /= y
        B_divisors.append(y)
    else:
        y += 1

    if (B <= 1):
        break

A_only = [x for x in A_divisors if (x not in B_divisors)]
B_only = [y for y in B_divisors if (y not in A_divisors)]

common_divisors = []
for z in (A_divisors + B_divisors):
    if z in A_divisors and z in B_divisors:
        if (A_divisors.count(z) >= B_divisors.count(z)):
            common_divisors.append(z**A_divisors.count(z))
        else:
            common_divisors.append(z**B_divisors.count(z))

        A_divisors = list(filter(lambda x: x != z, A_divisors))
        B_divisors = list(filter(lambda x: x != z, B_divisors))


result = 1
for x in A_only + B_only + common_divisors:
    result *= x

print(result)


### FIXED CODE ###

A = input()
B = input()
 
choices = "123"
answer = [x for x in choices if x != A and x != B]

print(int(answer[0]))
import math
import copy
import sys
import fractions
import numpy as np
from functools import reduce


# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

n = getInputInt()
data = getInputListInt()

ans = 0

#最小公倍数
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

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

lcm_num = lcm_list(data)

for i in range(n):
    ans += (lcm_num-1) % data[i]

print(ans)

### FIXED CODE ###

import math
import copy
import sys
import fractions
import numpy as np
from functools import reduce


# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

n = getInputInt()
data = getInputListInt()

ans = data[0]


for i in range(1, n):
    ans = ans * data[i] // fractions.gcd(ans, data[i])

prians=0
for i in range(n):
    prians += (ans-1) % data[i]
print(prians)
A=input()
B=input()
C=input()

print(A[0].B[1].C[2])

### FIXED CODE ###


U=input()
M=input()
B=input()

print(U[0]+M[1]+B[2])
N = int(input())
A = list(map(int, input().split()))
 
ans = 0
 
while all(a % 2 == 0 for a in A):
    ans += 1
    for i in range(N):
        A[i] = int(A[i] / 2)
 
print(ans)

### FIXED CODE ###

a,b,c=map(int,input())
print(a+b+c)
N, Y = map(int, input().split())
for i in range(N):
    for j in range(N-i):
        if 10000*i + 5000*j + 1000*(N-i-j) == Y:
            print('{} {} {}'.format(i,j,N-i-j))
            exit()
print("-1 -1 -1")

### FIXED CODE ###

N = int(input())
D = [int(input()) for _ in range(N)]
print(len(set(D)))
n = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range(1,5) :
    if a[i] - a[i-1] >= 0 :
        continue
    else :
        ans += abs(a[i] - a[i-1])
        a[i] += abs(a[i] - a[i-1])
print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range(n-1) :
    if a[i+1] - a[i] >= 0 :
        continue
    else :
        ans += abs(a[i+1] - a[i])
        a[i+1] += abs(a[i+1] - a[i])
print(ans)
H,W = map(int,input().split)
h,w = map(int,input().split)

print((H-h)*(W-w))

### FIXED CODE ###

H,W = map(int,input().split())
h,w = map(int,input().split())

print((H-h)*(W-w))