Harryxun/stf_run huggingface dataset:
num_of_subs, full_score, avg = [ int(i) for i in input().split(" ") ]
prevScores =  0
for i in input().split(" "):
  prevScores += int(i)

last_score = (avg * num_of_subs) - prevScores

if last_score <= 0:
  print(0)
else:
  if last_score >= 100:
    print(-1)
  else:
    print(last_score)

### FIXED CODE ###

inp = input()

import string
alphabets = list(string.ascii_lowercase)

print(alphabets[alphabets.index(inp) + 1])
import math
def func(x,y,z):
    ans = x**2 + y**2 + z**2+ x*y + y*z + z*x
    return ans

N = int(input())
array_N = [0]*N
root_n = round(math.sqrt(n+1))

for x in range(1,root_n):
    for y in range(1,root_n):
        for z in range(1,root_n):
            if func(x,y,z) <= N:
                array_N[func(x,y,z)-1] =array_N[func(x,y,z)-1] +1
                
for i in range(N):
    print(array_N[i])

### FIXED CODE ###


import math
def func(x,y,z):
    ans = x**2 + y**2 + z**2+ x*y + y*z + z*x
    return ans

N = int(input())
array_N = [0]*N
root_n = round(math.sqrt(N+1))

for x in range(1,root_n):
    for y in range(1,root_n):
        for z in range(1,root_n):
            if func(x,y,z) <= N:
                array_N[func(x,y,z)-1] = array_N[func(x,y,z)-1] +1
                
for i in range(N):
    print(array_N[i])
# coding:utf-8
def recurcive(N,c):
    if N%2==0 and N!=0:
        c+=1
        return recurcive(int(N/2),c)
    else:
        return c
#print(recurcive(8,0))

N=int(input())
maxim=0

for i in range(1,N+1):
    if recurcive(i,0) > maxim:
        maxim=ans
print(2**maxim)


### FIXED CODE ###

# coding:utf-8
def recurcive(N,c):
    if N%2==0 and N!=0:
        c+=1
        return recurcive(int(N/2),c)
    else:
        return c
#print(recurcive(8,0))

N=int(input())
maxim=0

for i in range(1,N+1):
    if recurcive(i,0) > maxim:
        maxim=recurcive(i,0)
print(2**maxim)
def cf(x1,x2):
    cf=[]
    for i in range(2,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf

cflist = cf(a,b)

import fractions
import itertools

for i in cflist:
        ans.append(i)
        for j in itertools.combinations(ans, 2):
                if 1 == fractions.gcd(j[0],j[1]):
                else:
                        ans.pop()
                        break

print(len(ans))

### FIXED CODE ###

def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table

a, b = map(int, input().split())
import fractions
print(len(set(prime_decomposition(fractions.gcd(a,b))))+1)
a, b, c = map(int, input.split())

if a + b + c <= 21:
  print('win')
else:
  print('bust')
  
        
        

### FIXED CODE ###

a, b, c = map(int, input().split())
 
if a + b + c <= 21:
  print('win')
else:
  print('bust')
a,b = map(int,input(),split())

if b >= a:
	print(a)
else
	print(a - 1)


### FIXED CODE ###

a,b = map(int,input().split())
 
if b >= a:
	print(a)
else:
	print(a - 1)
import math
if n%2 == 0:
  print(1/2)
else:
  print(math.ceil(n/2)/n)

### FIXED CODE ###

import math
n = int(input())
if n%2 == 0:
  print(1/2)
else:
  print(math.ceil(n/2)/n)
A11,A12,A13 = map(int, input().split())
A21,A22,A23 = map(int, input().split())
A31,A32,A33 = map(int, input().split())
N = int(input())
b = [int(input()) for _ in range(N)]

cnt11=0
cnt12=0
cnt13=0
cnt21=0
cnt22=0
cnt23=0
cnt31=0
cnt32=0
cnt33=0

for i in range(N):
    if b[i]==A11:
        cnt11+=1
    elif b[i]==A12:
        cnt12+=1
    elif b[i]==A13:
        cnt13+=1
    elif b[i]==A21:
        cnt21+=1
    elif b[i]==A22:
        cnt22+=1
    elif b[i]==A23:
        cnt23+=1
    elif b[i]==A31:
        cnt31+=1
    elif b[i]==A32:
        cnt32+=1
    elif b[i]==A33:
        cnt33+=1
    else:
        pass

bingo=0
if cnt11>0:
    if((cnt12>0 and cnt13>0)or(cnt22>0 and cnt33>0)or(cnt21>0 and cnt31>0)):
        bingo+=1
    else:
        pass
elif cnt12>0:
    if (cnt22>0 and cnt32>0):
        bingo+=1
    else:
        pass
elif cnt13>0:
    if((cnt22>0 and cnt31>0)or(cnt23>0 and cnt33>0)):
        bingo+=1
    else:
        pass
elif cnt21>0:
    if(cnt22>0 and cnt23>0):
        bingo+=1
    else:
        pass
elif cnt31>0:
    if(cnt32>0 and cnt33>0):
        bingo+=1
    else:
        pass
else:
    pass
if bingo>0:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

N=int(input())

if N%2==1:
	print(int(N/2)+1)
else:
	print(int(N/2))
import copy
import sys
H, W, M= map(int,input().split())
height = [0]*H
width = [0]*W
object = []
for s in sys.stdin.readlines():
    h, w = map(int, s.split())
    height[h-1] += 1
    width[w-1] += 1
    object.append([h-1, w-1])
h_max = max(height)
w_max = max(width)
cand_w = []
cand_h = []
for i in range(W):
   if width[i] == w_max:
      cand_w.append(i)
for i in range(H):
   if height[i] == h_max:
      cand_h.append(i)
ans = h_max + w_max - 1
p = len(cand_h)*len(cand_w)
if M >= p:
   for i in range(len(cand_h)):
      for j in range(len(cand_w)):
         if not [cand_h[i], [cand_w[j]] in object:
            ans = h_max + w_max            
else:
   ans += 1
print(ans) 

### FIXED CODE ###

import copy
import sys
H, W, M= map(int,input().split())
height = [0]*H
width = [0]*W
object = []
for s in sys.stdin.readlines():
    h, w = map(int, s.split())
    height[h-1] += 1
    width[w-1] += 1
    object.append([h-1, w-1])
h_max = max(height)
w_max = max(width)
cand_w = []
cand_h = []
for i in range(W):
   if width[i] == w_max:
      cand_w.append(i)
for i in range(H):
   if height[i] == h_max:
      cand_h.append(i)
ans = h_max + w_max
c = 0
p = len(cand_h)*len(cand_w)
cand_h = set(cand_h)
cand_w = set(cand_w)
if M >= p:
   for i in range(len(object)):
      if object[i][0] in cand_h and object[i][1] in cand_w:
         c += 1
print(ans - (c == p))
L = 100000
n,c = map(int, input().split())

# arr[col] には、区間の始まり ==> 1,区間中 ==> 0,区間終わり ==> -1
# 連続した区間は結合した形で表現される
arr = [[0]*L for j in range(c)]
for _ in range(n):
    s,t,col = map(lambda x:int(x)-1, input().split())
    arr[col][s] += 1
    arr[col][t] -= 1

imos = [0]*L

#全チャンネルを同時に考えたいもす法
for i in range(c):
    for p in range(L):
        if arr[i][p] == 1: imos[p] += 1    
        if arr[i][p] == -1: imos[p+1] -= 1


#累積和をとれば、区間内の最大のrec数は値のmax.
ans = 0
for i in range(1,L):
    imos[i] += imos[i-1]
    ans = max(ans, imos[i])

print(ans)


### FIXED CODE ###

L = 100005
n,c = map(int,input().split(" "))

# arr[col] には、区間の始まり ==> 1,区間中 ==> 0,区間終わり ==> -1
# 連続した区間は結合した形で表現される

arr = [[0]*L for _ in range(c)]

for i in range(n):
    s,t,col = map(int,input().split(" "))
    arr[col-1][s-1] += 1
    arr[col-1][t-1] -= 1

imos = [0]*L

#全チャンネルを同時に考えたいもす法
for i in range(c):
    for p in range(L):
        if arr[i][p] == 1: imos[p] += 1    
        if arr[i][p] == -1: imos[p+1] -= 1


#累積和をとれば、区間内の最大のrec数は値のmax.
ans = 0
for i in range(1,L):
    imos[i] += imos[i-1]
    ans = max(ans, imos[i])

print(ans)
s=list(input())
d=["A","G","C","T"]
a=[]
b=[]
x=[]
for i in range(len(s)):
    a.append(s[i:])
for j in a:
    for k in range(len(j)-1):
        b.append(j[:-k-1])
ans=a+b
for i in ans:
    if list(set(i)) == d:
        x.append(len(i))
    else:
        pass
print(max(x))

### FIXED CODE ###

s=list(input())
d=["A","G","C","T"]
a=[]
b=[]
x=[]
for i in range(len(s)):
    a.append(s[i:])
for j in a:
    for k in range(len(j)-1):
        b.append(j[:-k-1])
ans=a+b
for i in ans:
    if set(i) <= set(d):
        x.append(len(i))
    else:
        pass
if x:
  print(max(x))
else:
  print(0)
import turtle


def main():
    x = int(input())
    if False:
        print((360 // x) if 360%x == 0 else (360 // x)+1)
    else:
        k = 1
        temp = x
        while temp % 360 != 0:
            k += 1
            temp += x
        print(k)


    temp = 360 // x

if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    x = int(input())
    if False:
        print((360 // x) if 360%x == 0 else (360 // x)+1)
    else:
        k = 1
        temp = x
        while temp % 360 != 0:
            k += 1
            temp += x
        print(k)


    temp = 360 // x

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

visited = [None]*n
cur = 0
for i in range(k):
    if visited[cur] is None:
        visited[cur] = i
        cur = a[cur]-1
    else:
        break
else:
    print(cur+1)


k -= i
k %= i-visited[cur]

for i in range(k):
    cur = a[cur]-1

print(cur+1)

### FIXED CODE ###

import sys
n, k = map(int, input().split())
a = list(map(int, input().split())) 

visited = [None]*n
cur = 0
for i in range(k):
    if visited[cur] is None:
        visited[cur] = i
        cur = a[cur]-1
    else:
        break
else:
    print(cur+1)
    sys.exit()

k -= i
k %= i-visited[cur]

for i in range(k):
    cur = a[cur]-1

print(cur+1)
import math
while True:
    a,b = map(int,raw_input().split())
    print int(math.log10(a + b) + 1)

### FIXED CODE ###

import math
while True:
    try:
        a,b = map(int,raw_input().split())
        print int(math.log10(a + b) + 1)
    except EOFError:
        break
from math import factorial
n = int(input())
l = list(map(int, input().split()))

dict = {}
for i in l:
    if i not in dict:
        dict[i] = 1
    else:
        dict[i] += 1



for j in l:
    ans = 0
    k = dict.copy()
    k[j] -= 1
    # print(k)
    for v in k.values():
        if v > 1:
            ans += int(factorial(v) / factorial(2) / factorial(v - 2))
    print(ans)


### FIXED CODE ###

import collections
from collections import defaultdict

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

dict = defaultdict(int)
for i in l:
    dict[i]+=1

ans = 0
for v in dict.values():
    ans += int((v*(v-1)) // 2)

for k in l:
    print(ans - (dict[k] - 1))
W,H,x,y = map(int,input().split())

if W/x == 2 and H/y ==2:
    print(W*H/2,'1')
else:
    print(W*H/2,'0')

### FIXED CODE ###

W,H,x,y = map(int,input().split())


if x != 0 and y != 0:
    if W/x == 2 and H/y ==2:
        print(W*H/2,'1')
    else:
        print(W*H/2,'0')
else:
    print(W*H/2,'0')
N, M = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
total = sum(A)
print('Yes' if len(1 for a in A if a * 4 * M >= total) >= M else 'No')

### FIXED CODE ###

N, M = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
A.sort(reverse=True)
total = sum(A)
ans = 0
for a in A:
    if a * 4 * M >= total:
        ans += 1
print('Yes' if ans >= M else 'No')
import sys

def solve():
    N,M = map(int, input().split())
    
    l = [-1]*(N+1)
    for m in range(M):
        a = int(input())
        l[a] = 0
    if l[1] == 0 and l[2] == 0:
        return 0
    elif l[1] == 0 and l[2] != 0:
        l[2] = 1
    elif l[1] != 0 and l[2] == 0:
        l[1] = 1
    else:
        l[1] = 1
        l[2] = 2
    
    if N == 1:
        return 1
    if N == 2:
        return 2
    
    l.pop(0)
    for i in range(2,N):
        if l[i] == 0:
            continue
        else:
            l[i] = l[i-1] + l[i-2]
    
    return l[-1]%1000000007


if __name__ == '__main__':
    print(solve())

### FIXED CODE ###

def solve():
    N,M = map(int, input().split())
    if N == 1 and M == 0:
        return 1
    elif N == 1 and M == 1:
        return 0
    elif N == 2 and M == 0:
        return 2
    elif N == 2 and M == 1:
        return 1
    elif N == 2 and M == 2:
        return 0
    
    l = [-1]*(N+1)
    for m in range(M):
        a = int(input())
        l[a] = 0
    if l[1] == 0 and l[2] == 0:
        return 0
    elif l[1] == 0 and l[2] != 0:
        l[2] = 1
    elif l[1] != 0 and l[2] == 0:
        l[1] = 1
    else:
        l[1] = 1
        l[2] = 2
    
    l.pop(0)
    for i in range(2,N):
        if l[i] == 0:
            continue
        else:
            l[i] = l[i-1] + l[i-2]
    
    return l[-1]%1000000007


if __name__ == '__main__':
    print(solve())
N = int(input())
l = list(map(int, input().split()))
N_MAX =  int(1e+5 + 1)
cnt = [0 for _ in range(N_MAX)]
for i in l:
    cnt[i] += 1
ans = 0
for idx, val in enumerate(cnt):
    if val == 0 or val == idx:
        pass
    elif val < idx:
        ans += val
    elif idx < val:
        ans += val - idx
print(ans)

### FIXED CODE ###

N = int(input())
l = list(map(int, input().split()))
unique_l = list(set(l))
unique_l.sort()
l.sort()
l.append(0)
ans = 0
j = 0
cnt =[]
for i in unique_l:
    temp = 0
    while l[j] == i and j < N:
        temp += 1
        j += 1
    cnt.append(temp)
for i, j in zip(unique_l, cnt):
    if i == j:
        pass
    elif j > i:
        ans += j - i
    elif j < i:
        ans += j
print(ans)
n=int(input())
d=sorted(list(map(int, input().split())))
num=[0]*(max(d)+1)
num_=0
count=0
j=0
for i in range(len(d)):
    if d[i]==j:
        num[j]+=1
    elif d[i]==j+1:
        num[j+1]+=1
        j+=1
    else:
        j+=1
#print(num)
ans=1
for i in range(1, max(d)+1):
    #print(num[i-1]**num[i])
    #ans = ans * pow(num[i-1], num[i], 998244353)%998244353
    ans*=num[i-1]**num[i]

if d[0]!=0 or d.count(0)!=1:
    print(0)
else:
    print(ans%998244353)


### FIXED CODE ###

n=int(input())
if n%2 == 0:
    print((n>>1)-1)
else:
    print(n>>1)
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
A.sort()
B.sort()
C.sort()
ans=0
for j in range(N):
    a=bisect.bisect_left(a, B[j])
    c=bisect.bisect_right(a, B[j])
    ans+=a*c
print(ans)

### FIXED CODE ###

from bisect import bisect_left, bisect_right
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
A.sort()
B.sort()
C.sort()
ans=0
for j in range(N):
    a=bisect_left(A, B[j])
    c=bisect_right(C, B[j])
    ans+=a*(N-c)
print(ans)
n, m=map(int, input().split())
a=[0 for i in range(m)]
b=[0 for i in range(m)]
g=[list() for i in range(1+n)]
#print(g)

par=[i for i in range(n)]
cnt_con=[1 for i in range(n)]

def root(x):
    if x==par[x]:
        return x
    else:
        par[x]=root(par[x])
        return par[x]
def connect(x,y):
    #par[x]=root(x)
    #par[y]=root(y)
    if root(x)==root(y):
        0
    else:
        cnt_con[root(y)]+=cnt_con[root(x)]
        par[root(x)]=root(y)      
    return

for i in range(m):
    a[i], b[i]=map(int, input().split())
    a[i], b[i]=a[i]-1, b[i]-1


tmp=int(n*(n-1)/2)
ans=[0]*m
ans[-1]=tmp
#ans[0]=0
#print('a,b=',a,b)
for i in range(m-1,-1,-1):
    ans[i]=tmp
    if root(a[i])==root(b[i]):
        0
    else:
        tmp-=cnt_con[root(a[i])]*cnt_con[root(b[i])]
    connect(a[i],b[i])
    #print('i,tmp',i,(a[i],b[i]),ans[i],tmp,par,cnt_con)
    

    
for i in range(m):
    print(ans[i])

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)

n, m=map(int, input().split())
a=[0 for i in range(m)]
b=[0 for i in range(m)]
g=[list() for i in range(1+n)]
#print(g)

par=[i for i in range(n)]
cnt_con=[1 for i in range(n)]

def root(x):
    if x==par[x]:
        return x
    else:
        par[x]=root(par[x])
        return par[x]
def connect(x,y):
    #par[x]=root(x)
    #par[y]=root(y)
    if root(x)==root(y):
        0
    else:
        cnt_con[root(y)]+=cnt_con[root(x)]
        par[root(x)]=root(y)      
    return

for i in range(m):
    a[i], b[i]=map(int, input().split())
    a[i], b[i]=a[i]-1, b[i]-1


tmp=int(n*(n-1)/2)
ans=[0]*m
ans[-1]=tmp
#ans[0]=0
#print('a,b=',a,b)
for i in range(m-1,-1,-1):
    ans[i]=tmp
    if root(a[i])==root(b[i]):
        0
    else:
        tmp-=cnt_con[root(a[i])]*cnt_con[root(b[i])]
    connect(a[i],b[i])
    #print('i,tmp',i,(a[i],b[i]),ans[i],tmp,par,cnt_con)
    

    
for i in range(m):
    print(ans[i])
from collections import defaultdict
d = defaultdict(list)
n = int(input())
for i in range(n):
    city, point = input().split()
    d[city].append((int(point), i))

d2 = sorted(d.items())
for i in range(len(d2)):
    sorted(d2[i][1])
    for j in range(len(d2[i])):
        print(d2[i][1][j][1] + 1)



### FIXED CODE ###

from collections import defaultdict
d = defaultdict(list)
n = int(input())
for i in range(n):
    city, point = input().split()
    d[city].append((int(point), i+1))

d2 = sorted(d.items())
for i in range(len(d2)):
    d2[i] = list(d2[i])
    d2[i][1] = sorted((d2[i][1]), reverse = True)
    for j in range(len(d2[i][1])):
        print(d2[i][1][j][1])
N = int(input())
L = map(int, input().split())
x = sorted(L)
Lmax = max(L)
y = x[0:-1]
z = 0
for i in range(N-1):
    z = z + y[i]
print("Yes" if Lmax < z else "No")

### FIXED CODE ###

N = int(input())
L = list(map(int, input().split()))
x = sorted(L)
Lmax = max(L)
y = x[0:-1]
ysum = sum(y)
print("Yes" if Lmax < ysum else "No")
num = int(input())
  
elif num%2 != 0:
    print(str(num))
else:
    print(str(2*num))

### FIXED CODE ###

#jiaofhaosfhao
n=int(input())
if(n%2==1):
	n*=2
print(n)
from collections import Counter

N = int(input())
A = list(map(int, input().split()))
A_counter = Counter(A).most_common()
A_counter.sort(reverse = True)

ans = []

for i, cnt in A_counter.items():
    if cnt >= 2:
        ans.append(i)
        if len(ans) == 2:
            print(ans[0] * ans[1])
            break
    
    if cnt >= 4:
        print(i**2)
        break
    
else:
    print(0)

### FIXED CODE ###

from collections import Counter

N = int(input())
A = list(map(int, input().split()))
h = w = 0

for i, cnt in Counter(A).items():
    if cnt >= 2 and i > w:
        if i > h:
            if cnt >= 4:
                h = i
                w = i
            else:
                w = h
                h = i
        else:
            w = i
            
print(w * h)
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    k,r,l = LI()
    p = F()
    e = F()
    t = F()

    def f(k,r,l):
        if abs(r-t) <= e and abs(t-l) <= e:
            return 1
        if k == 0:
            if abs(t - (r+l) / 2) <= e:
                return 1
            return 0

        h = (r+l) / 2
        if h >= t:
            return f(k-1,r,h) * (1-p) + f(k-1,h,l) * p
        return f(k-1,r,h) * p + f(k-1,h,l) * (1-p)

    tr = f(k,r,l)

    return '{:0.9f}'.format(tr)



print(main())



### FIXED CODE ###

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    k,r,l = LI()
    p = F()
    e = F()
    t = F()

    def f(k,r,l):
        if abs(r-t) <= e and abs(t-l) <= e:
            return 1
        if t-l > e or r-t > e:
            return 0
        if k == 0:
            if abs(t - (r+l) / 2) <= e:
                return 1
            return 0

        h = (r+l) / 2
        if h >= t:
            return f(k-1,r,h) * (1-p) + f(k-1,h,l) * p
        return f(k-1,r,h) * p + f(k-1,h,l) * (1-p)

    tr = f(k,r,l)

    return '{:0.9f}'.format(tr)



print(main())
n, z, w = map(int, input().split())
l = list(map(int, input().split()))

def trial(n, z, w, t): 
  # n: 残りの枚数
  # z: Xの手持ち
  # w: Yの手持ち
  # t: これまでに引いた枚数
  min_score = [0]*n
  min_j = [0]*n
  for i in range(t,t+n):
    if i == t+n-1:
      min_score[n-1] = abs(l[t+n-1]-w)
      break
    temp = l[i]
    temp_min = 10**9+1
    for j in range(i+1, t+n):
      if abs(temp-l[j]) <= temp_min:
        temp_min = abs(temp-l[j])
        min_score[i-t] = temp_min
        min_j[i-t] = j
    #print(max(min_score))
  #print(min_score)
  #n -= (min_score.index(max(min_score))+1)
  if min_score.index(max(min_score)) == n-1:
    n = 0
    z = l[t+min_score.index(max(min_score))]
    w = w
  else:
    n = len(l) - (t+min_j[min_score.index(max(min_score))]+1)
    z = l[t+min_score.index(max(min_score))]
    w = l[t+min_j[min_score.index(max(min_score))]]
    t += (min_score.index(max(min_score))+1)
  return n, z, w, t
  
t = 0
while n > 0:
  n, z, w, t = trial(n, z, w, t)
  #print(n, z, w, t)
print(abs(z-w))

### FIXED CODE ###

n, z, w = map(int, input().split())
l = list(map(int, input().split()))

if n == 1:
  print(abs(l[0]-w))
else:
  print(max(abs(l[-1]-w), abs(l[-2]-l[-1])))
import sys
from collections import deque
p=10**9+7

def main(n,a):
  h=n//2
  g=n%2
  if g==1:
    if a.count(0)!=1:
      del a[a.index(0)]
  b=[0]*(n-g)
  d=deque(a)
  while d:
    x=d.pop()
    b[x-1-g]=x
    b[x-g]=x
  c=[2*(x//2)+g+1 for x in range(n-g)]
  if g==1:
    c.insert(0,0)
  if b!=c:
      return 0
  return 2**(h%(p-1))
n=int(input())
a=list(map(int,sys.stdin.readline().strip().split()))

print(main(n,a))
  

### FIXED CODE ###

import sys
from collections import deque
p=10**9+7

def main(n,a):
  h=n//2
  g=n%2
  a.sort()
  c=[2*(x//2)+g+1 for x in range(n-g)]
  if g==1:
    c.insert(0,0)
  if a!=c:
      return 0
  return 2**(h%(p-1)) % p

if __name__=='__main__':
  n=int(input())
  a=list(map(int,sys.stdin.readline().strip().split()))
  print(main(n,a))
import math 
a,b,c,d = map(int,input().split(" "))
count = 0

u = b - a + 1

cd = c * d // math.gcd(c, d)

c_num = b//c - (a-1)//c
d_num = b//d - (a-1)//d
cd_num = b//cd - (a-1)//cd

print(u - (c_num + d_num - cd_num))


### FIXED CODE ###

from fractions import gcd
 
def main():
    a,b,c,d = map(int,input().split(" "))
    n = b - a + 1
    cdiv = b//c - (a-1)//c
    ddiv = b//d - (a-1)//d
    cddiv = b//(c * d // gcd(c, d))  - (a-1)//(c * d // gcd(c, d))
    print(n - cdiv -ddiv + cddiv)
 
if __name__ == '__main__':
    main()
def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()
    
    n = int(input())
    a =list(map(int, input().split()))
    rate = [0]*8
    cnt = 0
    for x in a:
        r = x//400
        if r > 7:
            cnt += 1
        if not rate[r]:
            rate[r] = 1
    s = sum(rate)
    mins = s+max(0, cnt-s)
    maxs = s+cnt
    print(mins, maxs)        
        
            



if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()
    
    n = int(input())
    a = list(map(int, input().split()))
    rate = [0]*8
    cnt = 0
    for x in a:
        r = x//400
        if r > 7:
            cnt += 1
        elif not rate[r]:
            rate[r] = 1
    s = sum(rate)
    mins = s
    if cnt > 0:
        mins += 1
        if s > 0:
            mins -=1
    maxs = s+cnt
    print(mins, maxs)        
        
            



if __name__ == '__main__':
    main()
def solve(s, a, b):
    if a % b == 0:
        return s + ((a // b) * 2 - 1) * b
    if b % a == 0:
        return s + ((b // a) * 2 - 1) * a
    if a == b:
        return s + a
    elif a > b:
        return solve(s + b * 2, a - b, b)
    else:
        return solve(s + a * 2, a, b - a)

n, x = map(int, input().split())
print(solve(n, n - x, x))

### FIXED CODE ###

def solve(s, a, b):
    if a % b == 0:
        return s + ((a // b) * 2 - 1) * b
    if b % a == 0:
        return s + ((b // a) * 2 - 1) * a
    elif a > b:
        s += (a // b) * 2 * b
        return solve(s, a % b, b)
    else:
        s += (b // a) * 2 * a
        return solve(s, a, b % a)

n, x = map(int, input().split())
print(solve(n, n - x, x))
input()
l = map(int, raw_input().split())
l.reverse()
print(" ".join(map(str, l))

### FIXED CODE ###

input()
l = map(int, raw_input().split())
l.reverse()
print(" ".join(map(str, l)))