peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
s = input()
t = input()

result = ''
for i in range(len(s)-len(t),-1,-1):
  mth = 1
  for j in range(len(t)):
    if s[i+j] != t[j]:
      if s[i+j] == '?':
        pass
      else:
        mth = 0
        break
  if mth == 1:
#    print("i",i)
    result = s[:i]+t+s[i+len(t):]
    print(result.replace('?','a'))
    exit(0)

print("UNRESTORABLE")
# Judge status: Wrong Answer
N = int(input())
keta = 1
while (N-1)//26**keta >= 1:
    keta += 1
for i in range(1, keta):
    N -= 26**i
alph = 'abcdefghijklmnopqrstuvwxyz'
ans = []
ans.append(alph[(N%26)-1])
for i in range(1, keta):
    num = (N-1)//(26**i)
    if num ==0:
        ans.append("a")
    else:
        ans.append(alph[(num%26)])
ans.reverse()
print("".join(ans))
# Judge status: Accepted
N = int(input())

print(int((N * N * 3) / 3))
# Judge status: Wrong Answer
import math
A,B,C,D = map(int, input().split())

m = math.floor(B / C) + math.floor(B / D) - math.floor(B / (C*D))
 
n = math.floor((A-1) / C) + math.floor((A-1) / D ) - math.floor((A-1) / (C*D))
 
print(B-A+1-(m-n))
# Judge status: Accepted
print("YNeos"[int(input())%500>int(input())::2])
# Judge status: Accepted
from copy import deepcopy
from sys import exit,setrecursionlimit
import math
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac
import fractions
from functools import reduce
from operator import mul
import bisect
import sys
import logging
import heapq
import itertools

logging.basicConfig(level=logging.ERROR)

input = sys.stdin.readline

setrecursionlimit(1000000)


def main():
	n = int(input())
	a = list(map(int,input().split()))
	ans = list(reversed([a[i] for i in range(1 if n%2==0 else 0,n,2)])) + [a[i] for i in  range(0 if n%2==0 else 1,n,2)]
	for i in ans:
		print(i,end=' ')
	print()

main()
# Judge status: Wrong Answer
import collections

S = input()

c = collections.Counter(S)

d = len(c)

if d == 4:
    print("Good")

else:
    print("Bad")
# Judge status: Accepted
n, a, b = map(int, input().split())

MOD = 10 ** 9 + 7

def nCk(n, k):
    num = 1
    for i in range(n, n - k, -1):
        num *= i
        num %= MOD
    tmp = 1
    for i in range(1, k + 1):
        tmp *= i
        tmp %= MOD
    num *= pow(tmp, MOD - 2, MOD)
    return num

ans = pow(2, n, MOD) - 1
ans -= nCk(n, a)
ans -= nCk(n, b)
print(ans % MOD)
# Judge status: Accepted
import math
a, b, n = map(int, input().split())
x = min(b - 1, n)
ans = math.floor(a * x / b) - a * math.floor(x / b)
print(ans)
# Judge status: Accepted
a=open(0).read().split();print('YNeos'[all(t-set(map(a.index,a[9:]))for t in({0,3,6},{0,4,8},{2,4,6},{2,5,8},{3,4,5},{6,7,8}))::2])
# Judge status: Accepted
s = str(input())
for _ in range(len(s)):
    print('x',end='')
# Judge status: Wrong Answer
k=int(input())
x=0
ans=0
for i in range(1,10**5):
  if x==k:
    break
  ans+=1
  l = [int(x) for x in list(str(i))]
  y=0
  for j in range(int(len(l))-1):
    if l[j]==l[j+1] or l[j]==l[j+1]+1 or l[j]==l[j+1]-1:
      y+=1
  if y==int(len(l))-1:
    x+=1
print(ans)
# Judge status: Accepted
s = input()

count = 0
for i in range(len(s)):
    x = 0
    for j in range(i,len(s)):
        if(s[j] == 'A' or s[j] == 'C' or s[j] == 'G' or s[j] == 'T'):
            x += 1
        else:
            break
    if(count < x):
        count = x

print(count)
# Judge status: Accepted
pi = 6.28318530717958623200 / 2
print(pi * int(input()) * 2)
# Judge status: Wrong Answer
N = int(input())
S = input()
num = [0 for _ in range(N)]

for i in range(1, N):
  if S[i] == 'E':
    num[0] += 1

for i in range(1, N):
  if S[i-1] == 'W':
    num[i] = num[i-1] + 1
  if S[i] == 'E':
    num[i] = num[i-1] + 1
    
print(min(num))
# Judge status: Accepted
N, K = map(int, input().split())
A = list(map(int, input().split()))

for i in range(K, N):
    print('Yes' if A[i] > A[i - K] else 'No')
# Judge status: Wrong Answer
a, b, n = map(int, input().split())
max_v = 0
c = 0
for x in range(1, n+1):
  v = int(a*x/b)- a * int(x/b)
  c += 1
  if v > max_v:
    max_v = v
    c = 0
  if c > 10000000:
    break
print(v)
# Judge status: Accepted
n = int(input())
s = set()
for i in range(n):
    s.add(input())
print(len(s))
# Judge status: Wrong Answer
x=int(input())
import math
K=360/math.gcd(x,360)
print(K)
# Judge status: Accepted
N = int(input())
if N/1000 == N//1000:
    pay = N//1000 * 1000
else:
    pay = (N//1000+1)*1000
print(pay-N)
# Judge status: Accepted
import math
x = int(input())
ans = x//11
ans2 = x%11
if x <= 6:
    print(1)
elif x<=11:
    print(2)
else:
    if x%11 == 0:
        print(ans*2)
    else:
        if ans2 > 6:
            print(ans*2+2)
        else:
            print(ans*2+1)
# Judge status: Wrong Answer
n = int(input())

alp = [chr(v) for v in range(ord("a"), ord("z") + 1)]

results = []
def f(i=0, j=0, s="a"):
    if i == n - 1:
        return results.append(s)
    f(i + 1, j, s + alp[j])
    f(i + 1, j + 1, s + alp[j + 1])
f()
print(len(results))
print(*results, sep="\n")
# Judge status: Accepted
import collections

n,x = map(int,input().split())
a = list(map(int,input().split()))

ans = 0
q = collections.deque()
if a[0] <= x:
    q.append(a[0])
else:
    ans += a[0]- x
    q.append(x)

for i in range(1,n):
    tmp = q[-1] + a[i] 
    if tmp <= x:
        q.append(a[i])
    else:
        ans += tmp-x
        q.append(x-q[-1])
    q.popleft()


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

if (A + B) % 3 == 0:
    print('Possible')
else:
    print('Impossible')
# Judge status: Accepted
a,b,c = map(int,input().split())
A = [a,b,c]
B = [a,b,c]
A = A.count(5)
B = B.count(7)
if A == 2 and B == 1:
  print("YES")
else:
  print("NO")
# Judge status: Wrong Answer
n = input()
l = int(len(n))
ans = 0
if l == 1:
    print(n)
elif l % 2 ==1:
    ans += int(n) - 10**(l-1)+1
    for i in range(1,l):
        if i %2 ==1:
            ans += 9*(10**(i-1))
        else:
            ans = ans
  
else:
    for i in range(1,l):
        if i %2 ==1:
            ans += 9*(10**(i-1))
        else:
            ans = ans
print(ans)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
b = 0
for i in range(n):
    b ^= a[i]
ans = []
for i in range(n):
    ap = b ^ a[i]
    ans.append(ap)

print(*list(set(ans)))
# Judge status: Wrong Answer
import bisect
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

ans = 0
for a in A:
    b_ind = bisect.bisect(B, a)
    for b in B[b_ind:]:
        c_ind = bisect.bisect(C, b)
        ans += (n-c_ind)
    
print(ans)
# Judge status: Wrong Answer
W, H, x, y = map(int, input().split())

S = W * H
sx = min(W-x, x-0) * H
sy = min(H-y, y-0) * W

sMM = max(sx, sy)

same = 0
if sx > sy:
    if sx % W == 0 or W-x != x-0:
        same = 1
if sy > sx:
    if sy % H == 0 or H-y != y-0:
        same = 1
if sx == sy:
    same = 1

print(sMM, same)
# Judge status: Accepted
import numpy as np
(n,), *d = [[*map(int, i.split())] for i in open(0)]
a, b = np.median(d, axis=0)
if n%2:print(int(b - a + 1))
else:print(int(b*2 - a*2 + 1))
# Judge status: Accepted
n = int(input())

an = list(map(int,input().split()))
bn = list(map(int,input().split()))
cn = list(map(int,input().split()))
sat = sum(bn)

for x in range(n-1):
    if an[x+1] == an[x] + 1:
        sat += cn[an[x]-1]

print(sat)
# Judge status: Accepted
#!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import collections
import functools
import itertools
import math
import sys

INF = float('inf')


def solve(H: int):
    return 1 if H == 1 else solve(H//2) * 2 + 1


def main():

    sys.setrecursionlimit(10 ** 6)

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    print(f'{solve(H)}')


if __name__ == '__main__':
    main()
# Judge status: Accepted
N, M = map(int, input().split())
AB = [None] * N
for _ in range(N):
    AB[_] = list(map(int, input().split()))

AB.sort()

cart = 0
price = 0
j = 0
for i in range(N):
    if cart + AB[i][1] > M:
        j = i
        break
    cart += AB[i][1]
    price += AB[i][0] * AB[i][1]

price += (M - cart) * AB[j][0]
print(price)
# Judge status: Accepted
import sys
from fractions import gcd
input = sys.stdin.readline

n = input()
arr = list(map(int, input().split()))
tmp = arr[0]
for i in arr:
    tmp = tmp*i//gcd(tmp,i)
print(sum(tmp//a for a in arr) % (10**9+7))
# Judge status: Accepted
A,B,C,D = map(int, input().split())


if (C > A and C > B) or (A > C and A  >D):
    time =0
else:
    if A < C: # Bの方があとに押した場合
        if B < D:
            time = B-C
        else:
            time = D-C
    else:
        if B<D:
            time = B-A
        else:
            time = D-A
print(time)
# Judge status: Wrong Answer
N, X, T = map(int, input().split())

a = N // X
min_T = T*(a+1)

print(min_T)
# Judge status: Wrong Answer
x=int(input())
happiness=0
if(x>500):
	sum_amount=x//500
	happiness+=sum_amount*1000
	diff=x-happiness/2	
	z=int(diff/5)
	happiness+=z*5
	print(happiness)	

elif(x<500):
	k=int(x/5)
	ans=k*5
	print(ans)
elif(x==0):
	print(x)
# Judge status: Wrong Answer
from collections import defaultdict
import numpy as np

n, m = map(int, input().split())

list_ans = []
list_y = []
pre_p = -1
p_y = defaultdict(list)

for i in range(m):
    p, y = map(int, input().split())
    p_y[p].append(y)

for p in p_y.keys():
    list_y = p_y[p]
    list_num = np.argsort(list_y)
    for num in list_num:
        ans = str(p).zfill(6) + str(num + 1).zfill(6)
        print(ans)
# Judge status: Wrong Answer
n = int(input())
num_list = list(map(int, input().split()))
ans = 1
cnt_list = [0] * n

for i in range(1,n):
    if num_list[i-1] > num_list[i]:
        cnt_list[i] = -1
    if num_list[i-1] < num_list[i]:
        cnt_list[i] = 1

for i in range(1,n-1):
    if cnt_list[i] == 1:
        if cnt_list[i+1] == -1 or cnt_list[i-1] == -1:
            ans+=1

print(ans)
# Judge status: Wrong Answer
k,n,*a=map(int,open(0).read().split())
a+=[k+a[0]]
print(min(y-x for x,y in zip(a,a[1:])))
# Judge status: Accepted
x = input()

s, t = 0, 0
ols = 0
cnt = 0
for i in x:
  if i == "S":
    s += 1
  else:
    if s > 0:
     cnt += 1
     s -= 1
     s = max(s,0)
print (len(x)-cnt*2)
# Judge status: Wrong Answer
import re;
s = input();
print("YES" if re.fullmatch(r'^(dream|dreamer|eraser|erase)*$', s) else "NO")
# Judge status: Accepted
a,b=list(map(int,input().split()))
print(a+int(b/2))
# Judge status: Accepted
N, P = map(int, input().split())
A = list(map(int, input().split()))
even = 0
odd = 0
for i in range(N):
    if A[i]%2==0:
        even += 1
    else:
        odd += 1
if odd>=1:
    ans = pow(2,even+odd-1)
elif P==0:
    ans = pow(2,even)
else:
    ans = 0
print(ans)
# Judge status: Accepted
w,a,b = map(int,input().split())
ans = 0
if a+w<b:
    ans = b-(a+w)
elif b+w<a:
    ans = a-(b+w)
print(ans)
# Judge status: Wrong Answer
N = int(input())
counter = 0
ans = 0
for i in range(1,N+1):
    for j in range(1, N+1):
        if N % j == 0:
            counter += 1
    
    if counter == 8:
        ans += 1


print(ans)
# Judge status: Accepted
a, b, c = map(int, input().split())
if a+b+c >= 22:
  print('bust')
else:
  print('win')
# Judge status: Accepted
N=int(input())
A=[list(map(int,input().split())) for i in range(N)]

B=sorted(A,key=lambda x:x[1])
total=0
a=True
for i in range(N):
    total+=B[i][0]
    if total>B[i][1]:
        print("No")
        a=False
        break
if a==True:
    print("Yes")
# Judge status: Accepted
n=int(input())

def sieve(x):
  p=[2]
  b=[1]*x
  for i in range(2,x,2):  b[i]=0
  for i in range(3,x,2):
    if b[i]:
      p+=[i]
      for j in range(2*i,x,i): b[j]=0
  return p
def prime_factor(x):
  d={}
  for i in sieve(int(x**0.5)+1):
    while x%i<1:  x//=i;  d[i]=d.get(i,0)+1
    if x<2: break
  if x>1: d[x]=1
  return d

d=prime_factor(n)
a=0
for i in d.values():
  t=c=0
  while t+c<i: c+=1; t+=c
  a+=c
print(a)
# Judge status: Accepted
n = int(input())
if n%1000 == 0:
    print(0)
else:
    print(1000-n%1000)
# Judge status: Accepted
n = int(input())
t,a = map(int, input().split())
h = list(map(int, input().split()))

dic = []
for i in h:
  b = abs(a - (t - i * 0.006))
  dic.append(b)

print(dic.index(min(dic)) + 1)
# Judge status: Wrong Answer
import collections
n = int(input())
a = list(map(int,input().split()))
M = 0

c = collections.Counter(a)

for x in range(max(a)):
	d = c[x] + c[x-1] + c[x+1]
	if d > M:
		M = d

print(M)
# Judge status: Wrong Answer
import heapq
n,m = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(n)]
ab.sort()
queue = []
flag = 0
heapq.heapify(queue)
ans = 0
for i in range(1,m+1):
  for j in range(flag,n):
    if ab[j][0] > i:
      flag = j
      break
    heapq.heappush(queue,-ab[j][1])
  if queue != []:
    k = heapq.heappop(queue)
    ans += k
print(-ans)
# Judge status: Accepted
w, a, b = map(int, input().split())
if b > a + w:
    print(b - a - w)
elif a > b + w:
    print(a - b - w)
else:
    print(0)
# Judge status: Accepted
N, R = map(int, input().split())

if N < 10:
  InnerRating = 100 * (10 - N)
  print(InnerRating + R)
else: 
  print(R)
# Judge status: Accepted
N = int(input())
S = input()

ans = ''

lcount = 0
rcount = 0
now = 0
for i in range(N):
  si = S[i]
  if (lcount==0) and (si==')'):
    rcount += 1
    ans = '(' + ans + ')'
  elif si == ')':
    lcount -= 1
    ans = ans + ')'
  
  if (rcount>=1) and (si=='('):
    rcount = 0
    lcount = 1
    ans = ans + '('
  elif si == '(':
    ans = ans + '('
    lcount += 1
    

ans = ans + ')'*lcount
print(ans)
# Judge status: Accepted
N, W = (int(x) for x in input().split())
dp = [0] * (W+1) # Maximum value of items we can carry at weight
for _ in range(N):
  w, v = (int(x) for x in input().split())
  for cur in range(W, w-1, -1):
    dp[cur] = max(dp[cur-w]+v, dp[cur])

print(dp[W])
# Judge status: Wrong Answer
n,r=map(int,input().split())
print((n+r)//24)
# Judge status: Wrong Answer
R=float(input())

print(R**2*3.141592)
# Judge status: Wrong Answer
n=int(input())
a=list(map(int, input().split()))
sum=0
for i in range(60):
  x=0
  for j in a:
    if j>>i&1:x+=1
  sum+=x*(n-x)*(2**i)
print(int(sum%(1e9+7)))
# Judge status: Accepted
import sys
input = sys.stdin.readline

r = int(input())

import math

print(2*math.pi*r)
# Judge status: Accepted
a, b = map(int, input().split( ))
print(a*b)
# Judge status: Accepted
D = int(input())
print("Christmas" + " Eve" * (25 - D))
# Judge status: Wrong Answer
import math

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

sa = a ** 0.5
sb = b ** 0.5
sc = c ** 0.5


if sa + sb < sc:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
l,r,d = map(int,input().split())
cnt=0
for i in range(l,r+1):
    if i % d == 0:
        cnt += 1

print(cnt)
# Judge status: Accepted
s = input()
if len(set(s)) == 1:
    print('No')
else:
    print('Yes')
# Judge status: Accepted
#!/usr/bin/env python
# coding: utf-8

# In[26]:


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


# In[28]:


ans = 0
for i in range(N):
    ans += min(A[i], B[i])
    B[i] = max(B[i]-A[i], 0)
    ans += min(A[i+1], B[i])
    A[i+1] = max(A[i+1]-B[i], 0)
print(ans)


# In[ ]:
# Judge status: Wrong Answer
N = int(input())

X = N / 1.08

behind_point = X - int(X)
cond = behind_point == 0.0 or behind_point >= 0.5
if behind_point == 0.0:
    ans = int(X)
elif behind_point >= 0.5:
    ans = int(X) + 1
else:
    ans = ':('
print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
cnt = 0
for _ in range(31623):
    if all(i % 2 == 0 for i in a):
        cnt += 1
        a = [i//2 for i in a]
print(cnt)
# Judge status: Accepted
S = input()
a = []
z = []
for i, s in enumerate(S):
    if s == 'A':
        a.append(i + 1)
    elif s == 'Z':
        z.append(i + 1)

print(max(z) - min(a) + 1)
# Judge status: Wrong Answer
a, b = map(float, input().split())
a = int(a)
b1 = int(b * 100)
print(int((a*b1)//100))
# Judge status: Wrong Answer
n=int(input())
l=list(map(int,input().split()))
mod=10**9+7
import fractions
a=l[0]
for i in range(1,n):
   l[i]%=mod
   a=(a*l[i]//(fractions.gcd(a,l[i])))
print(a)
list=[(a//l[i])%mod for i in range(n)]
print(list)
print(sum(list)%mod)
# Judge status: Accepted
N, M = map(int, input().split())
A = sum(map(int, input().split()))

print(N - A) if N - A >= 0 else print(-1)
# Judge status: Accepted
N,D = map(int,input().split())
X = []
for i in range(N):
    X.append(list(map(int,input().split())))

ans = 0
for i in range(N):
    for j in range(i+1,N):
        d = 0
        for k in range(D):
            d += (X[i][k] - X[j][k])**2
        d = d**(1/2)
        if int(d) == d:
            ans +=1

print(ans)
# Judge status: Accepted
x,y,z=map(int,input().split())#整数を複数の変数に格納

print(z,x,y)
# Judge status: Wrong Answer
import sys
import math
A,B=map(int,input().split())
if A<B:
  A,B=B,A
if A%B==0:
  print(B)
  sys.exit()
L=[]
for i in range(1,math.ceil(A/2)):
  if A%i==0 and B%i==0:
    L.append(i)
print(int((A*B)/L[-1]))
# Judge status: Wrong Answer
import math
A,B,C,D=map(int,input().split())
E=C*D/math.gcd(C,D)
c=B//C-(A-1)//C
d=B//D-(A-1)//D
e=B//E-(A-1)//E
print(int(B-A+1-c-d+e))
# Judge status: Wrong Answer
NK = list(map(int, input().split()))
N = NK[0]
K = NK[1]

ans=0
for k in range(K,N+2):
    MIN = (k-1)*k/2
    MAX = N*(N+1)/2 - (N-k)*(N-k+1)/2
    ans += (MAX-MIN+1)
    
print(int(ans))
# Judge status: Accepted
import sys
from bisect import bisect_left
N=int(input())
L=list(map(int,input().split()))
L.sort()
total = 0
for i in range(N):
  for j in range(i + 1, N):
    a = L[i] + L[j]
    total += max(bisect_left(L, a) - j - 1, 0)

print(total)
# Judge status: Accepted
a,b,c = map(int,input().split())
if a%2==0 or b%2 == 0 or c%2 == 0:
    print(0)
    exit()
dum_li = [a,b,c]
dum_li.sort()
print(dum_li[0]*dum_li[1])
# Judge status: Accepted
a,b = map(int, input().split())
if a> 0:
  print("Positive")
elif b< 0 :
  if (b-a) % 2 == 0:
    print("Negative")
  else :
    print("Positive")
else : 
  print("Zero")
# Judge status: Wrong Answer
import numpy as np
n = input()
a = list(map(int, input().split()))
suma = np.prod(a)
if suma > 10**18:
    print(-1)
else:
    print(suma)
# Judge status: Accepted
X, K, D = map(int, input().split())
A= abs(X)%D
B = abs(X)//D
if abs(X) - K*D > 0:
  print(abs(X)-K*D)
elif K%2 != B%2:
  print(min(abs(A+D),abs(A-D)))
else:
  print(A)
# Judge status: Wrong Answer
n = int(input())
h =list(map(int, input().split()))

for i in range(n-1):
    if h[i] > h[i+1] and h[i]-1 <= h[i+1]:
        h[i] -= 1
    elif h[i]-1 > h[i+1]:
        print("No")
        exit()

for i in range(n-1):
    if h[i] > h[i+1]:
        print("No")
        exit()

print("Yes")
# Judge status: Wrong Answer
BOX = [int(j) for j in input().split(' ')]
BOX.sort(reverse=True)
print(int(((BOX[0] / 2 + BOX[0] % 2) * BOX[1] * BOX[2]) - (BOX[0] / 2  * BOX[1] * BOX[2])))
# Judge status: Accepted
n,m = map(int,input().split())
ans = 0
x = min(n,m//2)
n -= x
m -= x*2
ans += x

print(ans+m//4)
# Judge status: Wrong Answer
n=int(input())
XY=[list(map(int,input().split())) for i in range(n)]
minxy = [XY[0][0],XY[0][1]]
maxxy = [XY[0][0],XY[0][1]]
for xy in XY:
  if xy[0]+xy[1] < sum(minxy):
    minxy = xy[0],xy[1]
  if xy[0]+xy[1] > sum(maxxy):
    maxxy = xy[0],xy[1]
print(abs(minxy[0]-maxxy[0])+abs(minxy[0]-maxxy[1]))
# Judge status: Accepted
A,B,C,D=list(map(int,input().split()))
ans = 0
if D-A>0:
    ans+=A
    D-=A
else:
    print(D)
    exit()
if D-B>0:
    D-=B
else:
    print(ans)
    exit()
print(ans-D)
# Judge status: Wrong Answer
val1=list(map(int,input().split()))

if sum(val1)==17:
  print("OK")
else:
  print("NO")
# Judge status: Wrong Answer
N=int(input())
L = [list(map(int, input().split())) for i in range(N)]
dp=[[0 for j in range(3)] for i in range(N)]

for i in range(N):
  for P in range(3):
    for PY in range(3):
      if P==PY:
        continue
      elif i==0:
        dp[i][P]=L[i][P]
      else:
        dp[i][P]=max(dp[i][P],dp[i-1][PY]+L[i-1][P])
ans=0
for i in range(3):
  ans=max(ans,dp[N-1][i])
print(ans)
# Judge status: Wrong Answer
H1, M1, H2, M2, K = map(int, input().split())

print((H2 * 60) +  M2 - (H1 * 60) + M1 - K)
# Judge status: Accepted
s=input()
# dream dreamer erase eraser 
while len(s)>0:
	if (s[-1]=="r") & (s[-7:]=="dreamer"):
		s=s[:-7]
	elif (s[-1]=="r") & (s[-6:]=="eraser"):
		s=s[:-6]
	elif (s[-1]=="e") & (s[-5:]=="erase"):
		s=s[:-5]
	elif (s[-1]=="m") & (s[-5:]=="dream"):
		s=s[:-5]
	else:
		break

if len(s)==0:
	print("YES")
else:
	print("NO")
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
total = 0
for i in range(1, n):
  if a[i-1] > a[i]:
    total += a[i-1] - a[i]
    a[i] = a[i-1]
print(total)
# Judge status: Accepted
import math
a,b=map(int,input().split(" "))
print(math.ceil((a+b)/2))
# Judge status: Wrong Answer
def resolve():
	n = int(input())
	a = list(map(int, input().split()))
	m = sum(a)
	cnt = 0
	ans = float('inf')
	for i in range(len(a) - 1):
		cnt = abs(cnt + a[i])
		ans = min(ans, abs(m - cnt*2))
	print(ans)
resolve()
# Judge status: Wrong Answer
#<D>
#n<2*10**3だとforまわしたら間に合わん
from itertools import combinations
n = int(input())
l = list(map(int,input().split()))
l = list(set(l))
ans = 0
if len(l) < 3:
    print(0)
    exit()
for i in combinations(l,3):
    if abs(i[1] - i[2]) < i[0] and i[1] + i[2] > i[0]:
        ans += 1
print(ans)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
def pow2(a):
    return 1<<min(a, 63)
ans = 0
Cap = []
c = 1
for d, a in enumerate(A):
    Cap.append(c)
    c -= a
    if c < 0:
        print(-1)
        exit()
    c *= 2
    if c >= 1<<63:
        c = 1<<63
siz = 0
#print(Cap)
for d, a, cap in zip(range(N, -1, -1), A[::-1], Cap[::-1]):
    #print(d, a, cap)
    siz = min(siz+a, cap)
    ans += siz
    #print(siz)
print(ans)
# Judge status: Wrong Answer
str = input()
list = list(str)
abc = ['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']
i = 0
while abc[i] in str:
    if i < 25:
        i += 1
    else:
        break

if i < 26:
    print(abc[i])
else:
    print("None")
# Judge status: Accepted
A=input().split()
A = [int(s) for s in A]
K=int(input())
A.sort()
print(A[2]*2**K+A[0]+A[1])
# Judge status: Accepted
n, m = map(int, input().split())
T1 = [list(map(int, input().split())) for i in range(n)]
T2 = [list(map(int, input().split())) for i in range(m)]


for i in range(n):
    ans = 0
    man = 10 ** 9

    for j in range(m):
        tmp = abs(T1[i][0] - T2[j][0]) + abs(T1[i][1] - T2[j][1])
        if man > tmp:
            man = tmp
            ans = j + 1

    print(ans)
# Judge status: Accepted
N,K,Q = map(int,input().split())
# ans_list = [list(map(int,input().split())) for i in range(Q)]

ans_list = []
for i in range(Q):
    a = int(input())
    ans_list.append(a)
point_list = [K -Q]*N  #[i*0  for i in range(N)]

for i in range(Q):
    tem = ans_list[i] - 1
    point_list[tem] += 1

for i in range(N):
    if point_list[i] >0:
        print("Yes")
    else:
        print("No")
# Judge status: Wrong Answer
N,K = [int(_n) for _n in input().split()]
h = [int(_n) for _n in input().split()]
dp = [0]*N
dp[1] = abs(h[1]-h[0])
for i in range(1,N):
    dp[i] = 1000000
    for j in range(max(i-K,0), i):
        dp[i] = min(dp[i], dp[j]+abs(h[j]-h[i]))
print(dp[N-1])
# Judge status: Accepted
n =int(input())
ans = 0
for i in range(n+1):
  if i % 15 != 0 and i % 3 != 0 and i % 5 !=0:
    ans += i

print(ans)
# Judge status: Wrong Answer
n = int(input())
list_A = list(map(int, input().split()))
list_N = [0]
money = 1000
for i in range(1, n):
    if list_A[i-1] < list_A[i]:
        list_N.append(1)
    else:
        list_N.append(0)


k = 0
while True:
    if k == n-1:
        break
    k += 1
    if list_N[k-1] == 0 and list_N[k] == 1:
        l = k-1
        roll = money // list_A[l]
        money = money % list_A[l]
        money += list_A[k]*roll

print(money)
# Judge status: Wrong Answer
n=int(input())

if n<105:
    print(0)
elif 105<=n and n<135:
    print(1)
elif 135<=n and n<189:
    print(2)
elif 165<=n and n<189:
    print(3)
elif 189<=n and n<195:
    print(4)
else:
    print(5)