peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n = int(input())
a = [int(i) for i in input().split()]

def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)
def lcm(x, y):
    return (x * y) // gcd(x, y)

l = a[0]
for i in a[1:]:
    l = lcm(l, i)
b = []
for i in a:
    b.append(l//i)
ans = sum(b) % (10 ** 9 + 7)
print(ans)
# Judge status: Wrong Answer
[a, b, c, d] = [int(inp) for inp in input().split()]
print(max([a * c, b * d]))
# Judge status: Wrong Answer
S = list(input())
T = list(input())
lt = len(T)

result = 10**5
for i in range(len(S) - len(T) + 1):
    cnt = 0
    for s, t in zip(S[i: (i + lt)], T):
        if s != t:
            cnt += 1
    result = max(cnt, result)
print(result)
# Judge status: Accepted
a = int(input())
b = int(input())
h = int(input())
S = (a+b)*h/2
print(round(S))
# Judge status: Accepted
n = int(input())

INF = float("inf")

dp = [INF]*100010
dp[0] = 0

pow6 = [6**i for i in range(1,7)]
pow9 = [9**i for i in range(1,6)]

for i in range(1,n+1):
    dp[i] = dp[i-1] + 1
    for p6 in pow6:
        dp[i] = min(dp[i],dp[i-p6]+1)
    for p9 in pow9:
        dp[i] = min(dp[i],dp[i-p9]+1)

print(dp[n])
# Judge status: Accepted
data = input()
for _ in range(len(data)):
    data = data[:-1]
    count = len(data)
    if data[:count//2] == data[count//2:]:
        print(count)
        break
# Judge status: Accepted
import sys
import math
import itertools
#n=int(input())
x,y = map(int, input().split())
ans = 0
while (x <= y):
    x *= 2
    ans += 1
print(ans)
# Judge status: Accepted
n=int(input())

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

plus = []

minas = []

for value in a:
    if value < 0:
        minas.append(abs(value))
    else:
        plus.append(value)

if len(minas)%2 == 0:
    ans = sum(plus)+sum(minas)
else:
    if len(plus) > 0:
        mini = min(min(plus),min(minas))
        ans = sum(plus)+sum(minas)-mini*2
    else:
        mini = min(minas)
        ans = sum(minas)-mini*2

print(ans)
# Judge status: Accepted
ans = [1, 2, 3]
tmp = []
for i in range(2):
    tmp.append(int(input()))
    
for j in ans:
    if j not in tmp:
        print(j)
# Judge status: Accepted
s=input()
if len(s)==7:
    if s=="keyence":
        print("YES")
    else:
        print("NO")
else:
    if s[:7]=="keyence":
        print("YES")
    elif s[-7:]=="keyence":
        print("YES")
    else:
        for i in range(7-1):
            if s[:i+1]+s[-(7-i-1):]=="keyence":
                print("YES")
                exit()
        print("NO")
# Judge status: Accepted
# -*- coding: utf-8 -*-
N = int(input())
pos_x_list = []
pos_y_list = []

for i in range(N):
    x, y = map(int, input().split())
    pos_x_list.append(x - y)
    pos_y_list.append(x + y)

print(max(max(pos_x_list) - min(pos_x_list), max(pos_y_list) - min(pos_y_list)))
# Judge status: Accepted
N,A,B=map(int,input().split())
S=list(input())

p=0
q=0

for i in S:
    if p<A+B and i=="a":
        print("Yes")
        p+=1
    
    elif p<A+B and  i=="b" and q+1<=B:
        print("Yes")
        p+=1
        q+=1
    else:
        print("No")
# Judge status: Wrong Answer
A, B, C = map(int, input().split())

if B > A * C:
  print(A * C)
elif A * C > B and B > A:
  print(A)
else:
  print(0)
# Judge status: Accepted
a,b=map(int,input().split())
print("Possible" if (a%3==0) or (b%3==0) or((a+b)%3==0) else "Impossible")
# Judge status: Accepted
a, b, c = map(int, input().split())
color = set()
color.add(a)
color.add(b)
color.add(c)

print(len(color))
# Judge status: Wrong Answer
s=input()
L=s.split(" ")
a=int(L[0])
b=int(L[1])
c=int(L[2])
if 0<(c**2-c*a-c*b+a**2-c*a-b*c+b**2-2*a*b):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))

num=[0]*(max(a)+1)
for i in a:
  num[i]+=1
#print(num)
mx=0
for i in range(1,max(a)):
  #print(num[i-1:i+2])
  m=sum(num[i-1:i+2])
  if m>mx:
    mx=m

print(mx)
# Judge status: Accepted
n, k = map(int, input().split())
a = list(map(int, input().split()))


def cut(x):
    cut_count = 0
    for i in range(n):
        cut_count += (a[i]-1)//x
    return cut_count


l = 0
r = 10**9
while r-l > 1:
    mid = (l+r)//2
    if k >= cut(mid):
        r = mid
    else:
        l = mid
print(r)
# Judge status: Accepted
N = int(input())
S = input()

l_blacks = 0
r_whites = 0

for c in S:
    if c == '.':
        r_whites += 1

mins = r_whites
for c in S:
    if c == '.':
        r_whites -= 1
    if c == '#':
        l_blacks += 1
    mins = min(mins, r_whites + l_blacks)
print(mins)
# Judge status: Accepted
N, K = map(int,input().split())
mod = pow(10, 9) + 7

total = 0
for i in range(K, N + 2):
  maximum = (N - i + 1 + N) * i / 2
  minimum = (i - 1) * i / 2
  count = maximum - minimum + 1
  total += (count % mod)
  
print(int(total % mod))
# Judge status: Accepted
x, y, z = map(int, input().split())

print(z,x,y)
# Judge status: Wrong Answer
p = 10**9+7
N,M = map(int,input().split())
a = 1
for i in range(2,N+1):
    a = (a*i)%p
b = 1
for i in range(2,M+1):
    b = (b*i)%p
if M==N:
    n = (2*a*b)%p
else:
    n = (a*b)%p
print(n)
# Judge status: Accepted
n = int(input())
col = [399, 799, 1199, 1599, 1999, 2399, 2799, 3199]
a = list(map(int,input().split()))
col_set = set()
cnt = 0
for i in range(n):
    if a[i] >= 3200:
        cnt += 1
    for j in range(len(col)):
        if a[i] <= col[j]:
            col_set.add(j)
            break
print(max(len(col_set), 1), len(col_set)+cnt)
# Judge status: Accepted
from collections import deque

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

for i in range(n):
    if i % 2 == 0:
        b.append(a[i])
    else:
        b.appendleft(a[i])

if n % 2 == 1:
    b.reverse()

print(" ".join(map(str, b)))
# Judge status: Wrong Answer
def isu(x , y , z):

    ans = x // (y + z)

    return ans if x % (y + z) != 0 else ans - 1
def main():
    x , y , z = map(int , input().split())
    print(isu(x , y , z))


if __name__ == '__main__':
    main()
# Judge status: Accepted
N = int(input())
a = [int(input()) for _ in range(N)]

ans = 1
count = 0
for _ in range(N):
    ans = a[ans-1]
    count += 1
    if ans == 2:
        print(count)
        break
else:
    print(-1)
# Judge status: Accepted
import sys
def input():
    return sys.stdin.readline()[:-1]
k,x=map(int,input().split())
if 500*k>=x:
    print("Yes")
else:
    print("No")
# Judge status: Accepted

N, a, b = map(int, input().split())
total = 0
def FindSum(n):
    sum = 0
    while n > 0:
        sum += n % 10
        n = n //10

    return sum

for i in range(1, N + 1): 
    sum = FindSum(i)
    if a <= sum <= b:
        total += i

print(total)
# Judge status: Wrong Answer
import numpy as np

h,n=map(int,input().split())
a=[]
b=[]
c=[]

for i in range(n):
    A,B=map(int,input().split())
    a.append(A)
    b.append(B)
    c.append(float(A/B))
idx=np.argmax(c)
num=int(h/a[idx])
to=num*b[idx]


z=h%a[idx]
if z!=0:
    d=(-((-z)//(np.array(a))))
    e=d*np.array(b)
    to+=b[np.argmin(e)]
print(to)
# Judge status: Wrong Answer
a, b = map(int,input().split())
if a * b % 2 == 0:
    print("even")
else:
    print("odd")
# Judge status: Accepted


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    X = read_int()
    return (X//500)*1000+((X%500)//5)*5


if __name__ == '__main__':
    print(solve())
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
odd = 0
even = 0
even4 = 0
 
for num in A:
    if num % 2 == 1:
        odd += 1
    else:
        even += 1
    if num % 2 == 0 and num % 4 != 0:
        even4 += 1
even4 = even - even4
    
if odd == 0 or odd <= even4 or (odd + even4 == N and odd == even4 + 1):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N = int(input())

# 1個ずつ増えるキャンディー
# 必要なキャンディーの個数の合計を出力する。
x = N * (N + 1) // 2

print(x)
# Judge status: Accepted
N=int(input())
for i in range(1,N//2+10):
	tmp=((i+1)*(i))//2
	if N-tmp==0:
		print(i)
		exit()
	if N-tmp<i+1:
		print(i+1)
		exit()
# Judge status: Accepted
s = int(input())
ans = 1
while s not in [4, 2, 1]:
    ans += 1
    s = s // 2 if s % 2 == 0 else 3 * s + 1
print(ans + 3)
# Judge status: Wrong Answer
import math
import sys
def py():
    print("Yes")
def pn():
    print("No")
def iin():
    x = int(input())
    return x

neko = 1000
nya = 0
nuko = 0

s = input()
for a in range(len(s)-1):
    for b in range(a+1,len(s)):
        if s[a] == s[b]:
            pn()
            sys.exit()
py()
# Judge status: Wrong Answer
#!/usr/bin/env python3
n = int(input())
a = [0]
a += [int(input()) for i in range(n)]

cnt = 0
ps = 1

for _ in range(1, n + 1):
    ps = a[ps]
    cnt += 1

    if a[ps] == 2:
        print(cnt+1)
        break
else:
    print(-1)
# Judge status: Accepted
x = int(input())
q, mod = divmod(x, 11)
print(q * 2 + (mod + 6 - 1) // 6)
# Judge status: Accepted
import math
a,b = map(int,input().split())
print(math.ceil((a+b)/2))
# Judge status: Accepted
from sys import exit

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

sm = sum(a)
ans = 1

if n == 0:
  print(1 if a[0] == 1 else -1)
  exit()

if a[0] != 0 or a[n] == 0:
  print(-1)
  exit()
  
s = 1
for i in range(1, n+1):
  if a[i] > s * 2:
    print(-1)
    exit()
  s = min(s*2, sm)
  ans += s
  sm -= a[i]
  s -= a[i]
  
print(ans)
# Judge status: Accepted
AB, BC, CA = map(int, input().split())

print(BC * AB // 2)
# Judge status: Accepted
import itertools
n = int(input())
li1 = []
for i in range(n):
    li1.append(i+1)
li2 = list(itertools.permutations(li1,n))
p = tuple(map(int,input().split()))
q = tuple(map(int,input().split()))
print(abs(li2.index(p)-li2.index(q)))
# Judge status: Accepted
import numpy as np

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

zero = sum(A % 2 != 0)  # 2で割りきれない数
four = sum(A % 4 == 0)  # 4で割りきれる数
two = sum(np.logical_and(A % 2 == 0, A % 4 != 0))  # 4で割り切れないが、2で割りきれる数

flag = False

if two == 0:
    if zero <= four + 1:
        flag = True
else:
    if zero <= four:
        flag = True

if flag:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
N = int(input())
values = list(map(int, input().split()))
values_dict = {}

for value in values:
    values_dict[value] = values_dict.get(value, 0) + 1

print(values_dict.get(i, 0) for i in range(1, N+1))
# Judge status: Accepted
inf = 10**18
mod = 10**9+7

# a^n
def power(a,n,mod):
    x = 1
    while n:
        if n & 1:
            x *= a % mod
        n >>= 1
        a *= a % mod
    return x % mod


n,k = map(int, input().split())
d = list(input().split())
ans = n
for i in range(n, n*10+1):
    tmp = str(i)
    ok = True
    for c in tmp:
        if c in d:
            ok = False
            break
    if ok:
        ans = i
        break
print(ans)
# Judge status: Wrong Answer
N, A = int(input()), list(map(int, input().split()))
print("Yes" if len(set(A)) == len(A) else "No")
# Judge status: Wrong Answer
s=input()

ans=0
flag=False
n=0
for i in range(len(s)):
    if s[i]=="A":
        flag=True
        n+=1
        continue
    if s[i]=="Z":
        if flag:
            n+=1
            ans=max(ans,n)
            n=0
            flag=False
            continue
    if flag:
        n+=1
print(ans)
# Judge status: Wrong Answer
import math
a,b,h,m=map(int,input().split())
ang=6*m-30*h
if ang<0:
    ang*=-1
ang=ang*math.pi/180
r=math.sqrt(a*a+b*b+2*a*b*math.cos(ang))
print(r)
# Judge status: Accepted
A,B,C=(input().split())
K = int(input())
A = int(A)
B = int(B)
C = int(C)
for i in range(K):
    if B > C or C == B:
        C = C*2
    elif A > B or B == A:
        B = B*2
if A < B and B < C:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n=int(input())

x=n//11
y=n%11

if y<6:
  y=1
else:
  y=2
print(x*2+y)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

student_turn = [0] * (n + 1)
for i in range(n):
  student_turn[a[i] - 1] = i + 1
student_turn.pop()
print(" ".join(map(str,student_turn)))
# Judge status: Wrong Answer
n,m=map(int,input().split())
l=[]
for i in range(m):
    a,b=map(int,input().split())
    l.append(a)
    l.append(b)

import collections
c = collections.Counter(l)
for i in c.values():
    print(i)
# Judge status: Accepted
n=int(input())
h=list(map(int,input().split()))
ans=0
stp=0
for i in range(1,n):
    if h[i]<=h[i-1]:
        stp+=1
        ans=max(stp,ans)
    else:
        stp=0
print(ans)
# Judge status: Accepted
N = int(input())

result = 0
for A in range(1, N + 1):
    result += (N - 1) // A
print(result)
# Judge status: Wrong Answer
N, M = map(int, input().split())

# Mの約数を列挙
sup = int(M**0.5) + 1
divs = []
for i in range(1, sup+1):
  if M%i == 0:
    divs.append(i)

for d in divs[::-1]:
  if M//d >= N:
    print(d)
    quit()
# Judge status: Accepted
N = int(input())
L = list(map(int,input().split()))
L.sort()
ans = 0
import bisect
for i in range(N-2):
    
    for j in range(i+1,N-1):
        a = L[i]
        b = L[j]
        k = bisect.bisect_left(L,a+b)
        l = bisect.bisect_left(L,b-a)
        ans += k-max(j+1,l)
print(ans)
# Judge status: Accepted
N = int(input())

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

total = 0
minus = 0

l = []
for i in range(N):
  total += abs(A[i])
  l.append(abs(A[i]))
  if A[i] < 0:
    minus += 1

ans = total
if minus % 2 == 1:
  ans = total - 2 * min(l)

print(ans)
# Judge status: Accepted
A, B, C, X = [int(input()) for _ in range(4)]

ans = 0
for a in range(A + 1):
    for b in range(B + 1):
        for c in range(C + 1):
            if X == 500 * a + 100 * b + 50 * c:
                ans += 1
else:
    print(ans)
# Judge status: Wrong Answer
a = input()
al = list("abcdefghijklmnopqrstuvwxyz")
AL = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
if a in al:
    print(str.upper(a))
else:
    print(str.lower(a))
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

b = a[:]

dig_m = 30
cnt_dig = [1]*30
for i in range(dig_m):
    cnt = 0
    for j in range(n):
        if b[j] % 2 == 0:
            cnt += 1
        b[j] //= 2
    if cnt % 2 == 0:
        cnt_dig[i] = 0
cnt_dig.reverse()
cnt_dig = int(''.join(map(str, cnt_dig)), 2)

for i in range(n):
    print(a[i] ^ cnt_dig, end=' ')
# Judge status: Wrong Answer
import math
N = int(input())
A = list(map(int,input().split()))
l = list()
ll = list()
lll = list()
for i in range(len(A)):
  if A[i]%4 == 0:
    l.append(A[i])
  if A[i]%2 == 0:
    ll.append(A[i])
  if A[i]%2 != 0:
    lll.append(A[i])
four = len(l)
two = len(ll)-four
zero = N-two
a = math.floor(N/2)
b = A.count(0)

if zero <= four and b == 0:
  print("Yes")
elif zero-two <= four:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
N=int(input())
dic={}
for i in range(N):
  tmp=input()
  if tmp not in dic:
    dic[tmp]=1
  else:
    dic[tmp]+=1
max=0
for i in dic:
  if dic[i]>max:
    max=dic[i]
print(max)
# Judge status: Accepted
n, k = map(int, input().split())
s = [i for i in input()]
ans = []

for i in range(0,len(s)):
	
	if i == k - 1:
		ans.append(s[i].lower())
	else:
		ans.append(s[i])

print("".join(ans))
# Judge status: Accepted
a,b,c = map(int,input().split())

if a<c<b or b<c<a:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
a,b=map(int,input().split())
if (a+b)%2==0 :
  print((a+b)//2)
else :
  print((a+b)//2+1)
# Judge status: Accepted
import math

def is_prime(x):
    for i in range(2, int(math.sqrt(x)+1)):
        if x % i == 0:
            return False
    return True

x = int(input())

if x == 2:
    print(2)
else:
    while True:
        if is_prime(x):
            print(x)
            break
        else:
            x += 1
# Judge status: Wrong Answer
import sys

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

for i in range(x+1):
    if y == i*2 + (x-1)*4:
        print('Yes')
        sys.exit()

print('No')
# Judge status: Wrong Answer
def main():
  n, k = map(int, input().split())
  d = list(input().split())
  for i in range(n, 10000):
    if checknum(i, d):
      print(i)
      break

def checknum(n, d):
  for s in str(n):
    if d.count(s) > 0:
      return False
  return True
 
if __name__ == '__main__':
  main()
# Judge status: Accepted
# A - Between Two Integers

# 整数A,B,Cが入力される
# CがA以上かつB以下であるかを判定する


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

if A<=C and B>=C:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N,A,B = map(int,input().split())
S = input()

a_cnt = b_cnt = 0

for s in S:
  if s == "c":
    print("No")
  elif s == "a":
    if a_cnt+b_cnt < A+B:
      a_cnt += 1
      print("Yes")
    else:
      print("No")
  else:
    if a_cnt+b_cnt < A+B and b_cnt+1 <= B:
      b_cnt += 1
      print("Yes")
    else:
      print("No")
# Judge status: Accepted
n = int(input())
s = list(input())
ans = 0
for i in range(1, n-1):
    x = set(s[:i])
    y = set(s[i:])
    cnt = 0
    for c in x:
        if c in y:
            cnt += 1
    if cnt > ans:
        ans = cnt

print(ans)
# Judge status: Accepted
S = input()
left = int(S[:2])
right = int(S[2:])

if 0 < left <= 12:
    if 0 < right <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 0 < right <= 12:
        print('YYMM')
    else:
        print('NA')
# Judge status: Accepted
N = int(input())
ans = 0

for i in range(1, N + 1):

    n = N // i
    temp = (n * (n + 1) * i) // 2
    ans += temp

print(ans)
# Judge status: Wrong Answer
import sys

N, M = map(int, sys.stdin.readline().split())

if N > 1 and M > 1:
    four = 4
    six = (N - 2) * 2 + (M - 2) * 2
    nine = N * M - four - six
    print(nine)
elif N == 2 or M == 2:
    print(0)
else:
    two = 2
    three = N * M - two
    print(three)
# Judge status: Wrong Answer
a, b, c, x, y = list(map(int, input().split()))

ans = 10**5*max(a,b,c)
for i in range(0, max(x,y)+1):
    s = a*max(0,x-i)+b*max(0,y-i)+c*2*i
    ans = min(ans, s)
    
print(ans)
# Judge status: Accepted
X, Y = map(int, input().split())

for i in range(10**18):
  if X*2**i>Y:
    print(i)
    break
# Judge status: Accepted
import sys
N = int(sys.stdin.readline().rstrip())
l = list(map(int, sys.stdin.readline().rstrip().split()))
 
lm = 0
L = 0
for n in range(N):
  if l[n] > lm:
    L += lm
    lm = l[n]
  else:
    L += l[n]
    
if lm < L:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
N,K=map(int,input().split())
h=[int(input()) for _ in range(N)]
h.sort()
ans=10**9
for i in range(N-K+1):
  ans=min(ans,h[i+K-1]-h[i])
print(ans)
# Judge status: Accepted
d=int(input()) #365
c=list(map(int,input().split()))
s=[]
for i in range(d):
  s.append(list(map(int,input().split())))

ll=[0 for i in range(26)]
l=[]
ans=[]
for i in range(d):
  for j in range(26):
    ll[j]+=1
  m=-(10**10)
  for j in range(26):
    t=s[i][j]+ll[j]*c[j]
    if m<t:
      m=t
      tt=j
  l.append(ll[tt])
  ans.append(tt)
  ll[tt]=0
print("\n".join(map(lambda x:str(x+1),ans)))
# Judge status: Accepted
n,x,y = map(int,input().split())
ans = [0]*(n-1)
for i in range(1,n):
    for j in range(i+1,n+1):
        dis = min(j-i, abs(j-x)+1+abs(y-i), abs(j-y)+1+abs(x-i))
        ans[dis-1] += 1
for i in range(n-1):
    print(ans[i])
# Judge status: Accepted
a, b, x = map(int, input().split())
if a + b >= x and a <= x:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
N, K = map(int, input().split())

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

left = 0
right = 10**10

while right - left > 1:
    cut = 0
    mid = left + (right - left) // 2
    for a in A:
        cut += (a+mid-1)//mid - 1
    if cut <= K:
        right = mid
    else:
        left = mid

print(right)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
al = a[0]
ans = []
for i in range(1, n):
    al ^= a[i]
for i in range(n):
    ans.append(al^a[i])
print(*ans)
# Judge status: Accepted
A,B,M=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
L=[list(map(int,input().split())) for i in range(M)]
MA=min(a)
MB=min(b)
MC=MA+MB
for i in range(M):
  if a[L[i][0]-1]+b[L[i][1]-1]-L[i][2]<MC:
    MC=a[L[i][0]-1]+b[L[i][1]-1]-L[i][2]
print(MC)
# Judge status: Accepted
x,k,d=map(int,input().split())
x=abs(x)
m=min(k,x//d) 
x-=m*d
k-=m
if k%2:
  x=abs(x-d)
print(x)
# Judge status: Accepted
a, b=map(int, input().split())
print((a+b+1)//2)
# Judge status: Accepted
n = int(input())
train = []
for i in range(n-1):
    c,s,f = map(int,input().split())
    train.append((c,s,f))
for i in range(1,n+1):
    time = 0
    for j in range(i,n):
        if time <= train[j-1][1]:
            time = train[j-1][1]
        else:
            time = train[j-1][1] + (time - train[j-1][1] + train[j-1][2] - 1) // train[j-1][2] * train[j-1][2]

        time += train[j-1][0]
    print(time)
# Judge status: Wrong Answer
# input
H, W = map(int, input().split())

# process
ans = 0
if W == 1:
    print((H+1)//2)

elif H == 1:
    print((W+1)//2)

elif W%2 == 0:
    print(W//2 * H)
else:
    t = W//2
    if H%2 == 0:
        print((t*2 + 1) * H//2)
    else:
        print((t*2 + 1) * (H//2) + t + 1)
# Judge status: Accepted
N=int(input())
ans=[]
for i in range(1,10):
    for j in range(1,10):
        ans.append(i*j)
if N in ans:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n,m = map(int,input().split()); sus = {}
for _ in range(n):
  a,b = map(int,input().split())
  sus[a] = sus[a]+b if a in sus else b
fef = sorted(sus.items()); snaas = 0
for cuc in fef:
  snaas += cuc[1]
  if snaas >= m: print(cuc[0]); exit()
# Judge status: Wrong Answer
def abc122_b():
    s = input()
    acgt = ['A', 'C', 'G', 'T']

    check = [1 if s[i] in acgt else 0 for i in range(len(s))]

    result = 0
    for i in range(len(check)):
        for j in range(len(check)):
            if check[i:j].count(0) == 0:
                if result < len(check[i:j]):
                    result = len(check[i:j])

    print(result)

if __name__ == '__main__':
    abc122_b()
# Judge status: Accepted
s = list(str(input()))
q = int(input())
f = []
b = []
cnt = 0
for i in range (q):
    t = list(str(input()))
    if t[0] == '2':
        if t[2] == '1':
            f.append(t[4])
        else:
            b.append(t[4])
    else:
        x = f
        y = b
        f = y
        b = x
        cnt += 1
f.reverse()
if cnt%2 != 0:
    s.reverse()
    
print(''.join(f) + ''.join(s) + ''.join(b))
# Judge status: Accepted
ss = input().split('/')
yyyy = int(ss[0])
mm = int(ss[1])
dd = int(ss[2])

if mm >= 5:
    print('TBD')
else:
    print('Heisei')
# Judge status: Wrong Answer
S = input()
t = ["x" for i in range(len(S))]
print(*t)
# Judge status: Accepted
n,k=map(int,input().split())
ans=0
for i in range(1,n+1):
    temp=i
    count=0
    while temp<k:
        temp=temp*2
        #print(temp)
        count+=1
    ans+=0.5**count
print('{:.11f}'.format(ans/n))
# Judge status: Accepted
A, B, C = map(int, input().split())

if A <= C <= B or B <= C <= A:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n = int(input())
k = int(input())
x = int(input())
y = int(input())
if n <= k:
    print(x * n)
else:
    print(k*x + (n-k)*y)
# Judge status: Accepted
x=list(map(int,input().split()))
print(x.index(0)+1)
# Judge status: Wrong Answer
# coding: utf-8

num, blue_num, red_num = map(int, input().split())
all_ball = blue_num + red_num
if blue_num == 0:
    print(0)
else:
    rest = num % all_ball
    if rest < blue_num:
        blue = rest
    count = int(num / all_ball)
    print((count) * blue_num + rest)
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, M, K = mapint()
As = [0]+list(mapint())
Bs = [0]+list(mapint())
from itertools import accumulate
from bisect import bisect_right
ac = list(accumulate(As))
bc = list(accumulate(Bs))

ans = 0
for i in range(N+1):
    now = ac[i]
    rest = K-now
    if rest<0:
        break
    idx = bisect_right(bc, rest)
    ans = max(ans, i+idx-1)
print(ans)
# Judge status: Wrong Answer
import math 
baseArea = math.pi 
N = int(input())

inputArea = math.pi * N ** 2

print(int(inputArea/baseArea))
# Judge status: Accepted
X,A,B = map(int,input().split())

if B<=A:
  print("delicious")
elif B<=A+X:
  print("safe")
else:
  print("dangerous")
# Judge status: Accepted
n = int(input())
cnt = 0
for i in range(1,n+1):
    if len(str(i))%2 == 1:
        cnt +=1
print(cnt)