peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
d=int(input())
c=list(map(int,input().split()))
s=[]
for i in range(d):
  s.append(list(map(int,input().split())))
last=[0]*26

for day in range(d):
  co=[]
  dla=[]
  down=0
  for (i,j) in zip(last,c):
    down+=i*j
  for (i,j) in zip(last,c):
    dla.append(down-(j*(day-i)))
  for con in range(26):
    co.append(s[day][con]-dla[con]*c[con])
  choice=co.index(max(co))
  last[choice]=day
  print(choice+1)
# Judge status: Accepted
x=int(input())
i=1

while True:
  y=i*360/x
  i+=1
  if y%1==0:
    break
print(int(y))
# Judge status: Accepted
A, B = map(int, input().split(' '))

large = max(A, B)
small = min(A, B)

total = large
large -= 1
total += max(large, small)

print(total)
# Judge status: Accepted
n=int(input())
s=input()

t=[0]*n
if s[0]=="W":
  t[0]=-1
else:
  t[0]=1
for i in range(1,n):
  if s[i]=="W":
    t[i]=-1+t[i-1]
  else:
    t[i]=1+t[i-1]
    
max1=max(t)
a=t.index(max1)

ans=0
ans+=s[:a].count("W")

ans+=s[a+1:].count("E")
print(ans)
# Judge status: Accepted
n = int(input())
s = input()
count = 0
if n % 2 == 0:
    for i in range(n//2):
        if s[i] != s[i+n//2]:
            count += 1
else:
    count +=1
if count == 0:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
str = input().split(" ")
num = input().split(" ")

goal = int(str[1])
arr = {}

for i in num:
	i = int(i)

	if arr.get(i, False):
		arr[i] += 1
	else:
		arr[i] = 1

arr = dict(sorted(arr.items(), key=lambda d: d[1], reverse=True))

count = 0
for index, (i, key) in enumerate(arr.items()):
	if (index + 1) > goal:
		count += key

print(count)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
step = [0] * N
for i, a in enumerate(A[1:], 1):
    step[i] = -min(0, A[i - 1] + step[i - 1] - a)
print(sum(step))
# Judge status: Wrong Answer
def actual(s):
    N = len(s)
    count_operation = 0

    for i in range(N):
        head = s[i]
        tail = s[N - 1 - i]

        if head != tail:
            count_operation += 1

    return count_operation / 2

s = input()
print(actual(s))
# Judge status: Wrong Answer
x = [int(x) for x in input().split()]

for i in range(len(x)):
    if(x[i]==0):
        print(i)
# Judge status: Accepted
# coding: utf-8
import math

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

m = (h * w)

if h == 1:
    print(1)
    exit()
if w == 1:
    print(1)
    exit()

if m % 2 == 0:
    print(int(m / 2))
else:
    print(math.floor(m / 2) + 1)
# Judge status: Accepted
T = str(input())
A = T.replace('?','D')
print(A)
# Judge status: Accepted
import math
N = int(input())
A = [0] + list(map(int, input().split( )))
B = [0]*(N+1)
s = 0
for i in reversed(range(1, N+1)):
  ball = 0  
  for j in range(i,N+1,i):
    ball += B[j]
  if ball%2 != A[i]:
    B[i] = 1
    s += 1

print(s)
print(*[i for i, b in enumerate(B) if b == 1], sep=' ')
# Judge status: Accepted
from fractions import gcd
from math import ceil
def f(x):
  cnt=0
  while x%2==0:
    x//=2
    cnt+=1
  return cnt
n,m=map(int,input().split())
a=list(map(int,input().split()))
b=[a[i]//2 for i in range(n)]
g=b[0]
for i in range(1,n):
  g=g*b[i]//gcd(g,b[i])
t=f(a[0])
for i in range(n):
  if t!=f(a[i]):
    print(0)
    exit()
else:
  print(int((m/g+1)//2))
# Judge status: Accepted
a,b = input().split()
a = int(a)
b = int(b)
c = 0
for i in range(1001):
    d = c*0.08
    e = c*0.1
    d = int(d)
    e = int(e)
    if d == a and e == b:
        print(c)
        break
    elif c == 1000:
        print('-1')
        break
    else:
        c += 1
# Judge status: Wrong Answer
a, b, c = map(int, input().split())

if a == b + c or b == a + c or c == a + b:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
n,k = map(int, input().split())
s = list(str(input()))

s[k-1] = s[k-1].lower()

print(''.join(s))
# Judge status: Accepted
N = int(input())
a = [int(x) for x in input().split()]
cnt4 = 0
cnt2 = 0
for x in a:
    if x % 4 == 0:
        cnt4 += 1
        continue
    if x % 2 == 0:
        cnt2 += 1
cnt2 = cnt2//2*2
if N-cnt2 > 2*cnt4+1:
    print('No')
else:
    print('Yes')
# Judge status: Accepted
A,B,C,D = map(int, input().split())
THP = A
AHP = C
while(True):
    #高橋のターン
    AHP -= B
    if(AHP <= 0):
        print("Yes")
        break
    #青木のターン
    THP -= D
    if(THP <= 0):
        print("No")
        break
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
count2 = 0
count4 = 0
for i in range(n):
    #２の倍数だが４の倍数でない
    if a[i]%2 == 0 and a[i]%4 != 0:
        count2 += 1
    #４の倍数
    elif a[i]%4 == 0:
        count4 += 3

#print(count2,count4)

#２の倍数が奇数か偶数か判定
if count2 >= 2 and count2%2 == 0:
    count4 += count2
elif count2 >= 2 and count2%2 == 1:
    count4 += count2+1

if count4 >= n:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N = int(input())

X = []

for i in range(N):
    x,l = list(map(int,input().split()))
    X.append([x-l,x+l])

X.sort(key = lambda x: x[1])

count = 0
prev = -10**27
for i in range(N):
    if prev<=X[i][0]:
        prev = X[i][1]
        count+=1

print(count)
# Judge status: Accepted
A,B,T = map(int,input().split())
time = 0
bis = 0
while (time + A <= T+0.5):
  bis += B
  time += A
print(bis)
# Judge status: Accepted
d,t,s = map(int,input().split())
if s*t - d >=0:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
lun_luns = [1, 2, 3, 4, 5, 6, 7, 8, 9]
k = int(input())
index = 0
while True:
	if len(lun_luns) >= k:
		break
	num = lun_luns.pop(index)
	lun_luns.insert(index, num)
	mod = num % 10
	n = num * 10
	if mod == 9:
		lun_luns.extend([n+mod-1, n+mod])
	else:
		lun_luns.extend([n+mod-1, n+mod, n+mod+1])
	index += 1
print(lun_luns[k-1])
# Judge status: Accepted
import math
def prim(x):
  for i in range(2,math.floor(math.sqrt(x))):
    if not x%i:
      return 0
  return 1

def np(x):
  while(1):
    if prim(x):
      return x
    else:
      x+=1
      
print(np(int(input())))
# Judge status: Accepted
N = int(input())
H = list(map(int, input().split()))

dp = [float("inf")] * N
dp[0] = 0

for n in range(1,N):
  dp[n] = min(dp[n], dp[n-1]+abs(H[n]-H[n-1])) 
  if n >= 2:
    dp[n] = min(dp[n], dp[n-2]+abs(H[n]-H[n-2]))
  
print(dp[-1])
# Judge status: Wrong Answer
##C
N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
##print(A+B)
C = A+B
##print(C)
i = 0
j = 0
goukei = 0
if K >= sum(C):
    print(N+M)
else:
    A = A+[10**9]
    B = B+[10**9]
    while goukei <= K: 
        if A[i] <= B[j]:
            goukei += A[i]
            i += 1
        else:
            goukei += B[j]
            j += 1
    print(i+j-1)
# Judge status: Wrong Answer
n = int(input())
A = list(map(int, input().split()))

ans = [0] * n

for i in range(n):
    ans[i] = A.index(i+1) + 1
print(ans)
# Judge status: Wrong Answer
a, b = map(int, input().split())
if a < b:
  print(a * int(b))
else:
  print(b * int(a))
# Judge status: Wrong Answer
n = int(input())
a  = list(map(int,input().split()))
N = max(a)
res = 10**10
k = []
for i in range(n):
    
    if abs(a[i]-N/2) <= res:
        res = abs(a[i] -N/2)
        k.append(a[i])
k.sort()
print(N,k[0])
# Judge status: Wrong Answer
def abc126c():
    import math
    n, k = map(int, input().split())
    ans = 0.0
    for i in range(1, min(k, n + 1)):
        v = math.ceil(math.log2(k / i))
        ans += math.pow(0.5, v)
    if n > k:
        ans += n - k + 1
    print((1 / n) * ans)


abc126c()
# Judge status: Accepted
a,b,c=sorted(map(int,input().split()))
print("Yes" if a+b==c else "No")
# Judge status: Accepted
# -*- coding: utf-8 -*-

input_line = input()
N = list(input_line)

for i in N:
    if i=='7':
        print('Yes')
        quit()
print('No')
# Judge status: Accepted
a,b = input().split()
A,B = input().split()
c = input()
a = str(a)
b = str(b)
A = int(A)
B = int(B)
c = str(c)
d = A - 1
D = B - 1
if c == a:
    print(d,B)
elif c == b:
    print(A,D)
# Judge status: Accepted
N=int(input())
MOD=10**9+7

ans=10**N %MOD
ans=ans-2*9**N %MOD
ans=ans+8**N %MOD

print(ans%MOD)
# Judge status: Accepted
n, a, b = map(int,input().split())

mod = 10**9+7

def combi(n,r):
    x, y = 1,1
    for i in range(n-r+1,n+1):
        x *= i
        x %= mod
        
    for j in range(1,r+1):
        y *= j
        y %= mod
    yinv = pow(y,mod-2,mod)
    
    return x*yinv%mod

def main():
    nca = combi(n,a)
    ncb = combi(n,b)
    ans = pow(2,n,mod)-1 - (nca + ncb)
        
    print(ans%mod)
    
main()
# Judge status: Accepted
n,m=map(int,input().split())
if n==m:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n = int(input())

if n%10 == 2 or n%10 ==4 or n%10 ==5 or n%10 ==7 or n%10 ==9:
    print('hon')
elif n % 10 == 0 or n%10 ==1 or n%10 ==6 or n%10 == 8:
    print('pon')
else:
    print('bon')
# Judge status: Accepted
a,b,c = [int(s) for s in input().split()]
r = (c-a-b)**2
l = 4*a*b
if (c-a-b)<0:
    print('No')
elif l<r:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
from sys import stdin
input = stdin.readline

s = input()
a = b = c = 0
a = (s[0] == 'R') * 1
b = (s[1] == 'R') * (1 + a)
c = (s[2] == 'R') * (1 + b)
print(max(a, b, c))
# Judge status: Accepted
import sys
input = sys.stdin.readline

# D - Brick Break
n = int(input())
a = list(map(int, input().split()))
i = 1
bricks = 0

for ai in a:
	if ai == i:
		bricks += 1
		i += 1

if bricks == 0:
	print(-1)
else:
	print(n - bricks)
# Judge status: Accepted
def make_divisors(m,n):
    divisors = []
    ans = 0
    for i in range(1, int(n**0.5)+1):
        if n % i == 0 and m <= n//i and ans < i:
            ans = i
            if i != n//i and m <= i and ans < n//i:
                ans = n//i
    print(ans)

n,m = map(int, input().split())
make_divisors(n,m)
# Judge status: Accepted
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

N = int(input())
A = int(input())

print("Yes" if N % 500 <= A else "No")
# Judge status: Accepted
A,B = map(int,input().split())
print("Yay!" if A <= 8 and B <= 8 else ":(")
# Judge status: Wrong Answer
import numpy as np
N = int(input())
M = np.fromiter(input().split(), dtype=int)
K = (0.5) ** np.arange(1, N+1)
K[-1] = K[-2]
print(np.dot(M, K))
# Judge status: Wrong Answer
N = int(input())
M = map(int,input().split())

M = sorted(M)

alice = 0
bob = 0

for i in range(N):
    if i % 2 == 0:
        alice += M[i]
    else:
        bob += M[i]
        
print(alice - bob)
# Judge status: Accepted
MOD = 2019

l, r = map(int, input().split())
if r - l >= 2019:
    print(0)
    exit()
lst = []
for num in range(l, r + 1):
    lst.append(num % MOD)
ans = 2020
ll = len(lst)
for i in range(ll):
    for j in range(i + 1, ll):
        tmp = (lst[i] * lst[j]) % MOD
        ans = min(ans, tmp)
print(ans)
# Judge status: Accepted
S, T = map(str, input().split())
A, B = map(int, input().split())
U = str(input())

if S == U:
  A -=1
elif T == U:
  B -=1

print(A, B)
# Judge status: Accepted
f=lambda:tuple(map(int,input().split()))
n=int(input())
tp,tq=f(),f()
import itertools as it
l=list(it.permutations(range(1,n+1)))
print(abs(l.index(tp)-l.index(tq)))
# Judge status: Accepted
N=int(input())
S=input()

r=S.count('R')
g=S.count('G')
b=S.count('B')

count=r*g*b

for i in range(N):
  for d in range(N):
    j=i+d
    k=j+d
    if k>=N:
      break
    if S[i] != S[j] and S[j] !=S[k] and S[k] != S[i]:
      count -=1

print(count)
# Judge status: Wrong Answer
n = int(input())
s = input()
l = len(s)
ans = ""
z = ord("Z") - 1
for i in range(l):
    k = ord(s[i]) + n
    if k > z:
        k = k - z + ord("A")
    ans = ans + chr(k)

print(ans)
# Judge status: Accepted
'''input
2
ABCXYZ
'''
# A coding delight https://ideone.com/m98Hht
from sys import stdin
input = stdin.readline


# main starts
n = int(input().strip())
string = list(input().strip())
for i in range(len(string)):
	if ord(string[i]) + n > 90:
		string[i] = chr(64 + n - (90 - ord(string[i])))
	else:
		string[i] = chr(ord(string[i]) + n)

print(''.join(string))
# Judge status: Wrong Answer
N, D = map(int, input().split())
X=[]
f=0
for i in range(N):
    X.append(list(map(int,input().split())))
for i in range(N-1):
    for j in range(i+1, N):
        ans=0
        print(X[i] , X[j])
        for k in range(D):
            ans = ans + (X[i][k] - X[j][k])**2
        ans = (ans)**0.5
        print(ans)
        if ans==int(ans):
            f+=1
print(f)
# Judge status: Accepted
def main():
    K = int(input())
    S = str(input())

    if len(S) <= K:
        print(S)
    else:
        print(S[0:K] + "..." )

if __name__ == "__main__":
    main()
# Judge status: Accepted
X = int(input())

c = X // 100
d = X - 100 * c

for _ in range(c):
    if (d == 0):
        break
    elif (d >= 5):
        d -= 5
    else:
        d -= d

if (d == 0):
    print(1)
else:
    print(0)
# Judge status: Wrong Answer
def is_sum_nine(str_N):
    if str_N == "0" or str_N == "9":
        return True
    sum = 0
    for i in range(len(str_N)):
        sum += int(str_N[i])
    if len(str(sum)) < 5:
        if sum % 9 == 0:
            return True
        else:
            return False
    else:
        is_sum_nine(str(sum))


def main():
    N = input()
    if is_sum_nine(N):
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()
# Judge status: Accepted
n=int(input())
if n:
  print(0)
else:
  print(1)
# Judge status: Accepted
a,b = map(int,input().split())
c = b-a
cnt =0
for i in range(c):
    cnt += (i+1)
print(cnt-b)
# Judge status: Accepted
def main():
    a,b,c  = map(int,(input().split()))

    if c-a-b <0:
        print('No')
    elif 4*a*b - (c-a-b)**2 < 0:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()
# Judge status: Accepted
import fractions
A, B = map(int, input().split())

def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct

g=fractions.gcd(A, B)
#print(g)
lst=factorize(g)
#print(lst)
print(1+len(set(lst)))
# Judge status: Accepted
from fractions import gcd
N=int(input())
A=list(map(int,input().split(' ')))
L = 1
def lcm(x,y):
    return x//gcd(x,y)*y
for a in A:
    L = lcm(L,a)
ans=0
for a in A: ans+=L//a
print(ans%(10**9+7))
# Judge status: Accepted
n = int(input())
a = [int(an) for an in input().split()]

remaining_leafs = sum(a)

layer_count = 1
vertex_count = 0
for i in range(len(a)):
    vertex_count += layer_count
    layer_count -= a[i]
    remaining_leafs -= a[i]
    if layer_count < 0:
        vertex_count = -1
        break
    layer_count = min(layer_count*2, remaining_leafs)

print(vertex_count)
# Judge status: Accepted
n,m = map(int,input().split())
if(( n ==1) &( m == 1)):
    print(1)
if( (n == 1) & (m != 1)):
    print(m - 2)
if( (n != 1) & (m == 1)):
    print(n - 2)
    
if ((n != 1) &( m != 1)):
    print(n*m -(2*n + 2*m -4))
# Judge status: Accepted
def main():
    N = int(input())
    A = [int(a) for a in input().split()]
    xor_all = A[0]
    
    for i in range(1, N):
        xor_all ^= A[i]

    for i in range(N):
        if i != N - 1:
            print(A[i]^xor_all, end=" ")
        else:
            print(A[i]^xor_all)

if __name__ == "__main__":
    main()
# Judge status: Accepted
n = int(input())
a = 0

for n in range(1,n+1):
    if n % 3 != 0 and n % 5 != 0:
        a +=  n
print(a)
# Judge status: Accepted
O = str(input())
E = str(input())
P = ''
for i in range(len(E)) :
    P = P + O[i]
    P = P + E[i]
if len(O) == len(E) :
    print(P)
else :
    print(P + O[-1])
# Judge status: Accepted
x,y = map(int,input().split())
ans=0
while x*2**ans<=y: ans+=1
print(ans)
# Judge status: Accepted
A, B = map(int, input().split())
print(A * B)
# Judge status: Wrong Answer
import bisect
n = int(input())
l = [int(x) for x in input().split()]

l.sort()

ans = 0
for a in range(n - 1):
    for b in range(a + 1, n):
        c = bisect.bisect(l, l[a] + l[b])
        if b < c:
            ans += c - (b + 1)

print(ans)
# Judge status: Accepted
at,s,co=input().split()
print(at[0]+s[0]+co[0])
# Judge status: Wrong Answer
S=[1,2,4,8,16,32,64]
a=int(input())
S.append(a)
S=sorted(S)
print(S[max(S.index(a)-1,0)])
# Judge status: Accepted
l = int(input().strip())

l1 = l / 3

print(l1 ** 3)
# Judge status: Wrong Answer
K = int(input())
x = 7
count = 1
if K % 2 ==0:
  print("-1")
  exit(0)
for i in range(100000000000):
  if x % K == 0:
    print(count)
    exit(0)
  else:
    x = 10*x + 7
    count += 1
print("-1")
# Judge status: Accepted
import numpy as np
 
N=int(input())
A=np.array(list(map(int,input().split())))
 
odd=np.count_nonzero(A%2!=0)
four=np.count_nonzero(A%4==0)
ans='No'

if odd==1 and four>=1:
  ans='Yes'
elif odd==2 and four>=2:
  ans='Yes'
else:
  if odd+four==N and odd-1<=four:
    ans='Yes'
  elif odd<=four:
    ans='Yes'
print(ans)
# Judge status: Accepted
a, b, c = list(map(int, input().split()))

m = max(a, b, c)
s = sum([a, b, c])
if (3 * m - s) % 2 == 0:
    print((3 * m - s) // 2)
else:
    print((3 * m + 3 - s) // 2)
# Judge status: Wrong Answer
N = int(input())
x = 0

while N > 2**x:
  x += 1
else:
  result = 2 **(x -1)
  
print(result)
# Judge status: Accepted
s=input()

s1=s[0]+s[1]
s2=s[2]+s[3]

if (s1[0]=='0' and s1!='00') or s1=='11' or s1=='12':
  ans1='MM'
else:
  ans1='YY'

if (s2[0]=='0' and s2!='00') or s2=='11' or s2=='12':
  ans2='MM'
else:
  ans2='YY'

if ans1==ans2=='MM':
  print('AMBIGUOUS')
elif ans1==ans2=='YY':
  print('NA')
else:
  print(ans1+ans2)
# Judge status: Accepted
A = list(map(int, input().split()))

if sum(A) >= 22:
    print('bust')
else:
    print('win')
# Judge status: Accepted
p, q, r = map(int, input().split())

print(min([p + q, q + r, r + p]))
# Judge status: Accepted
n=int(input())
if n>=1000:
    print("ABD")
else:
    print("ABC")
# Judge status: Accepted
n,m = map(int, input().split())
a = (n-1) // 2
d = 1
memo = set([])
for i in range(m):
    if n-d in memo or 2*d == n:
        d += 1
    memo.add(d)
    print(a, a+d)
    a -= 1
    d += 2
# Judge status: Accepted
n = input()
_list = input().split(" ")
_list = [int(x) for x in _list]
even = [x for x in _list if x % 2==0]
answer = []
for x in even:
    if x % 3 == 0 or x % 5 == 0:
        answer.append(True)
if len(even) ==len(answer):
    print("APPROVED")
else:
    print("DENIED")
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
for i in range(1,n-1):
    if ans<sum(a[:i])+sum(b[i:])+b[i-1]:
        ans=sum(a[:i])+sum(b[i:])+b[i-1]
print(ans)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
ans = []
tmp = a[0]
for i in range(1,n):
    tmp = tmp^a[i]
for i in range(n):
    ans.append(tmp^a[i])
print(ans)
# Judge status: Accepted
x = int(input())

ans = (x//500)*1000 +((x%500)//5)*5

print(ans)
# Judge status: Accepted
a,b=map(int,input().split())
print(a-1+(a<=b))
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-

def main():

    N = int(input())

    ans = 1

    for i in range(N):
        ans *= (i + 1)

    ans % (10 ** 9 + 7)

    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
x, y = map(int, input().split())
a = [1,3,5,7,8,10,12]
b = [4, 6, 9, 11]
c = [2]

r = 'No'
if x in a and y in a:
  r = 'Yes'
if x in b and y in b:
  r = 'Yes'
if x in c and y in c:
  r = 'Yes'
  
print(r)
# Judge status: Wrong Answer
n,x=map(int,input().split()) #n都市xスタート座標
a=list(map(int,input().split()))
import fractions
if n==1:
    print(a[0]-x)
    quit()
p=[]
for i in range(1,n):
    p.append(a[i]-a[i-1])
if len(p)==1:
    ans=1
else:
    ans=p[0]
for i in range(1,n-1):
    ans=fractions.gcd(ans,p[i])
print(abs(ans))
# Judge status: Accepted
# coding: utf-8
# Your code here!
import math 
a, b = map(int,input().split())
Flg = True
for i in range(10**5+2):
    if int(i * 0.08) == a and int(i * 0.1) == b:
        print(i)
        Flg = False
        break
if Flg:
    print(-1)
# Judge status: Wrong Answer
a, b = map(int,input().split())
ans = a + b

for i in range(100000):
  if ans > 24:
    ans -= 24
  elif ans <= 24:
    break
    
print(ans)
# Judge status: Accepted
X = int(input())
tmp = 0
ans = 0
while tmp < X:
  tmp += ans+1
  ans += 1
print(ans)
# Judge status: Wrong Answer
n = int(input())

if (n % 7) % 4 == 0:
    print('Yes')

else:
    print('No')
# Judge status: Accepted
X = int(input())
tmp = X
count = 1
while 360 != tmp:
  tmp += X
  count += 1
  if tmp > 360:
    tmp -= 360
print(count)
# Judge status: Wrong Answer
N = int(input())
P = list(map(int, input().split()))
la = list(range(1,N+1))
cnt1 = 0
cnt2 = 0
while cnt1 < N-1:
    if P[cnt1] == la[cnt1]:
        cnt2 += 1
    cnt1 += 1
if cnt2 >= N-2:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
A, B = map(int, raw_input().split())
if (A + B) % 3 == 0:
    print "Possible"
elif (A or B) % 3 == 0:
    print "Possible"
else:
    print "Impossible"
# Judge status: Wrong Answer
N, A, B = map(int, input().split())
 
x = A + B
 
num = 1
y = 0
while N <= y:
  y = x * num
  num += 1
 
if N - num * x < A:
  print( A * num + ( N - num * x ) )
else:
  print( A * ( num + 1 ) )
# Judge status: Wrong Answer
import itertools
N, M, Q = list(map(int, input().split()))
a = []
b = []
c = []
d = []

for i in range(Q):
  aa, bb, cc, dd = list(map(int, input().split()))
  a.append(aa)
  b.append(bb)
  c.append(cc)
  d.append(dd)

Ms = [i for i in range(1, M+1)]

res = 0
for s in itertools.combinations(Ms, N):
  sum_ = 0
  for j in range(Q):
    if s[b[j]-1] - s[a[j]-1] == c[j]:
      sum_ += d[j]
  if sum_ > res:
    res = sum_

print(res)
# Judge status: Wrong Answer
n = int(input())
l = [2, 1]
for _ in range(n):
    k = l[-1] + l[-2]
    l.append(k)

print(l[n-1])
# Judge status: Accepted
N,M,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))

xmax = max(x)
ymin = min(y)

ans = 'War'
for z in range(X+1,Y+1):
    if xmax < z <= ymin:
        ans = 'No War'
        break

print(ans)
# Judge status: Accepted
n=int(input())
l=[111,222,333,444,555,666,777,888,999]
for i in range(1000):
    if n in l:
        print(n)
        exit()
    n+=1
# Judge status: Wrong Answer
N = int(input())
print(N*3.1415)
# Judge status: Wrong Answer
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

n = inn()
a = inl()
h = {}
for x in a:
    if x not in h:
        h[x] = 0
    h[x] += 1
b = []
for x in h:
    if h[x]>=2:
        b.append(x)
if len(b)<2:
    print(0)
else:
    print(b[-1]*b[-2])
# Judge status: Accepted
import sys
from collections import defaultdict, Counter, namedtuple, deque
import itertools
import functools
import bisect
import heapq
import math

MOD = 10 ** 9 + 7
# MOD = 998244353
# sys.setrecursionlimit(10**8)

x, y, a, b, c = map(int, input().split())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))

P = sorted(P, reverse=True)[:x]
Q = sorted(Q, reverse=True)[:y]
concat = P + Q + R
concat.sort(reverse=True)
print(sum(concat[:x+y]))
# Judge status: Accepted
N = int(input())
Word = []
tail = ""
for i in range(N):
    W = list(input())
    head = W[0]
    W = ''.join(W)
    if i != 0:
        if tail != head or (W in Word):
            print("No")
            exit()
    tail = W[-1]
    Word.append(W)
print("Yes")
# Judge status: Accepted
L, R = map(int, input().split())
a=[]

if R-L>=2019:
  ans=0
else:
  l, r = L%2019, R%2019
  ans=2018**2
  for i in range(l,r):
    for j in range(l+1,r+1):
        k = (i*j) % 2019
        ans = min(ans,k)
print(ans)
# Judge status: Wrong Answer
import sys
n = int(input())
a = list(map(int, input().split()))
postCenter=dif=0
tmp = sys.maxsize
for i in range(n):
    if tmp < abs(sum(a[:i])-sum(a[i:])):
        tmp = abs(sum(a[:i])-sum(a[i:]))
print(tmp)