peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n=int(input())
cst=list(map(int,input().split()))
arr=[0]*10**5
arr[0]=0
arr[1]=abs(cst[1]-cst[0])
if n==2:
    print(arr[1])
else:
    for i in range(2, n):
        arr[i] = min(abs(cst[i - 1] - cst[i]) + arr[i - 1], abs(cst[i - 2] - cst[i]) + arr[i - 2])
    print(arr[i])
# Judge status: Accepted
#abc070 b 
a,b,c,d=map(int,input().split())
if d<a or b<c:
    print(0)
else:
    print(min(b,d)-max(a,c))
# Judge status: Wrong Answer
s=input()
tmp = 0
ans = -1
flg= 1
for i in range(len(s) -1):
  if s[i] in ["A","G","C","T"]:
    tmp += 1
  else:
    if ans <= tmp:
      ans = tmp
      flg = 0
      tmp = 0
if s[-1] in ["A","G","C","T"]:
  ans = max(ans, tmp +1)

print(ans if flg==0 else tmp)
# Judge status: Accepted
a, b = map(int, input().split())
if a > b:
    ans = a + a - 1
elif a < b:
    ans = b + b - 1
else:
    ans = a + b
print(ans)
# Judge status: Accepted
N,M = map(int,input().split())
steps = [1,1,2]
for i in range(3,N+1):
    steps.append(steps[i-1]+steps[i-2])
ans = 1
a = 0
mod = 10**9+7
for i in range(M):
    b = int(input())
    b -=1
    if(b<a):
        print(0)
        exit()
    else:
        ans = ans*steps[b-a]%mod
    a = b+2
ans = ans*steps[N-a]%mod
print(ans)
# Judge status: Accepted
a, b, c = map(int, input().split())

if (c - a - b) ** 2 > 4 * a * b and c - a - b > 0:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N=int(input())
s = [int(input()) for i in range(N)]

if sum(x%10!=0 for x in s) == 0:
    print(0)
elif sum(s)%10!=0:
    print(sum(s))
else:
    l = [i for i in s if i % 10 != 0 ]
    l.sort()
    ans=sum(s)-l[0]
    print(ans)
# Judge status: Accepted
from functools import reduce
from fractions import gcd

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

L = [reduce(gcd, A[1:])]
l = A[0]
for i in range(N-1):
    l = gcd(l, A[i])
    L.append(l)

R = [reduce(gcd, A[:N-1])]
r = A[-1]
for i in range(N-1, 0, -1):
    r = gcd(r, A[i])
    R.append(r)

ans = 1
for i in range(N):
    ans = max(ans, gcd(L[i], R[-(i+1)]))

print(ans)
# Judge status: Accepted
N = int(input())

ans = 2 * 10**5

for n in range(1,N//2 + 1):
  a = n
  b = N - n
  
  sum_a = sum(list(map(int,list(str(a)))))
  sum_b = sum(list(map(int,list(str(b)))))
  
  ans = min(ans,sum_a+sum_b)
print(ans)
# Judge status: Accepted
a, b, c, d = map(int, input().split())
if abs(a-c) <= d or (abs(a-b) <= d and abs(b-c) <= d):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
N,Y = map(int,input().split())

for i in range(N+1):
    A = i
    for j in range(N+1):
        B = j
        C = N - A - B
        if C < 0:
            break
        s = 10000*A+5000*B+1000*C
        if s == Y:
            a = str(A)
            b = str(B)
            c = str(C)
            print(a+" "+b+" "+c)
            exit()

print("-1"+" "+"-1"+" "+"-1")
# Judge status: Wrong Answer
N = int(input())
a = list(map(int,input().split()))
count = 0
count2 = 0
for i in range(N):
  if a[i]%4 == 0:
    count += 1
  elif a[i]%2 == 0:
    count2 += 1
if count+(count2//2) >= N//2:
  print("Yes")
else:
  print("NO")
# Judge status: Accepted
[(a,b,c),(d,e,f),(g,h,i)] = [map(int,input().split()) for i in range(3)]

if a-b==d-e==g-h and b-c==e-f==h-i:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
N = input()
print(''.join(max(N)*3))
# Judge status: Wrong Answer
S, T = input().split()

print(S + T)
# Judge status: Accepted
a,b,c=map(int,input().split())
 
ans = 0
 
while a%2 == b%2 == c%2 == 0:
  ans += 1
  newa=b//2+c//2
  newb=a//2+c//2
  newc=a//2+b//2
  a=newa
  b=newb
  c=newc
  if a == b == c:
    print("-1")
    break
else:
  print(ans)
# Judge status: Accepted
n = int(input())
s = input()
t = input()

for i in range(n):
    if s[i:] == t[:n-i]:
        print(n*2 - (n-i))
        exit(0)

print(2*n)
# Judge status: Accepted
c= int(input())
ans =0
s = 0

while c >1:
    c = c//2
    ans += 1

for i in range(1,ans+1):
    s += 2**i

print(s+1)
# Judge status: Wrong Answer
color=input()
iro=color.split(" ")
i=0

if int(iro[0])==int(iro[1]):
    i=i+0
else:
    i=i+1

if int(iro[0])==int(iro[2]):
    i=i+0
else:
    i=i+1
  
if int(iro[1])==int(iro[2]):
    i=i+0
else:
    i=i+1
    
print(str(i))
# Judge status: Accepted
n = int(input())
z = []
w = []
for i in range(n):
    x,y = map(int,input().split())
    z.append(x+y)
    w.append(x-y)
zmax = max(z)-min(z)
wmax = max(w)-min(w)
print(max(zmax,wmax))
# Judge status: Wrong Answer
a, b, c, x, y = map(int, input().split())
n = a*x + b*y
sx, rx = divmod(x, 2)
sy, ry = divmod(y, 2)
s = 2*min(sx, sy)
m = 2*c*s + a*(2*sx-s+rx) + b*(2*sy-s+ry)
print(min(n, m))
# Judge status: Accepted
import math

h = int(input())
w = int(input())
n = int(input())

l = max(h, w)
print(math.ceil(n/l))
# Judge status: Accepted
X = int(input())

q = X // 100

if X%100<=q*5:
  print('1')
else:
  print('0')
# Judge status: Accepted
N, K = map(int, input().split())
S = input()
ans = ''
for i in range(N):
    ans += S[i] if i != (K - 1) else str(S[i]).lower()
print(ans)
# Judge status: Accepted
a, b, k = map(int, input().split())
for i in range(a, min(b, a + k - 1) + 1):
    print(i)
for i in range(max(b - k + 1, a + k), b + 1):
    print(i)
# 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()))

A.sort()
B.sort()
C.sort()

ans = 0
for b in B:
    a = bisect.bisect_left(A, b)
    c = bisect.bisect_right(C, b)
    ans += (a + 1)*c 

print(ans)
# Judge status: Accepted
import numpy as np
import functools
import math
import collections
import scipy
import fractions
import itertools

def solve():
  a, b = map(int, input().split())
  if b <= 1:
    print(0)
  elif a >= b:
    print(1)
  else:
    print(math.ceil((b-a)/(a-1))+1)
  return 0
 
if __name__ == "__main__":
  solve()
# Judge status: Accepted
a,s,c = input().split()

print(a[0]+s[0]+c[0])
# Judge status: Accepted
N,K = map(int,input().split())
lst = [list(map(int,input().split())) for _ in range(N)]
#print(lst)
#print(lst.sort())
lst.sort(key=lambda l:l[0])
#print(lst)

sm = 0
for x in lst:
    sm += x[1]
    #print(lst[i][1])
    if sm >= K:
        print(x[0])
        break
# Judge status: Accepted
a = int(input())

for i in range(1, int(a ** .5)+2):
  if i ** 2 > a:
    print((i-1)**2)
# Judge status: Accepted
d=int(input())
if d==25:
    print("Christmas")
elif d==24:
    print("Christmas Eve")
elif d==23:
    print("Christmas Eve Eve")
else:
    print("Christmas Eve Eve Eve")
# Judge status: Accepted
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
s = [input() for _ in range(n)]
cnt = Counter(s)
print(len(cnt))
# Judge status: Accepted
import itertools
def main():
  n = input()
  print("Yes" if n.count('9') else "No")
if __name__ == '__main__':
  main()
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-

S = list(str(input()))

while len(S) > 1:
    S.pop()
    if S[0 : len(S) // 2] == S[len(S) // 2 :]:
        print(len(S))
# Judge status: Accepted
nm = input('')
n = int(nm.split(' ')[0])
m = int(nm.split(' ')[1])
alist = input('').split(' ')

t = 0
for i in range(n):
  t += int(alist[i])

  s = 0
for i in range(n):
  a = int(alist[i])
  if a*4*m >= t:
    s+=1

if s >= m:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
A,B,C = map(int,input().split())
ans =[]
flag =False
for i in range(1,A*B):
    temp =  (A*i)%B
    ans.append(temp)
for j in ans:
    if j == C:
        flag = True
        break
    else:
        flag = False
if flag ==True:
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
a=int(input())
b=list(map(int,input().split()))
i=0
c=0
for i in range(a-1):
  if b[i-1]<b[i]<b[i+1]:
    c+=1
  i+=1
print(c)
# Judge status: Accepted
s = input()

days = ['SUN','MON','TUE','WED','THU','FRI','SAT' ]

day = int(days.index(s))
#print(day)
print(7-day)
# Judge status: Wrong Answer
# coding: utf-8
# Your code here!
n=input()
if n[0]==9 or n[1]==9:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))


xor=0
for i in range(n):
    xor ^= a[i]

print(xor)
ans=[]
for i in range(n):
    ans.append(xor ^ a[i])

print(*ans,sep=" ")
# Judge status: Wrong Answer
import math
n,d = map(int,input().split())
try:
  a = [list(map(int,input().split())) for j in range(0,n)]
except EOFError:
  pass
c = 0
r = 0
for i in range(0,n):
  for j in range(i+1,n):
    for k in range(0,d):
      c+=(a[i][k]-a[j][k])**2
  if math.sqrt(c)==int(math.sqrt(c)):
    r += 1
print(r)
# Judge status: Wrong Answer
n=int(input())
v=list(map(int ,input().split()))
l=[]
draw_list=[]
second_draw=[]
for i in range(0,len(v)-1):
    first_combination=float((v[i]+v[i+1])/2)
    draw_list.append(first_combination)
    # print(draw_list)
for j in range(0,len(v)-1):
    second_combination=float((draw_list[j]+v[j])/2)
    second_draw.append(second_combination)
    # print(second_draw)

draw_list.extend(second_draw)
print(int(max(draw_list)))
# Judge status: Accepted
h,w  = map(int,input().split())
if h== 1 and w == 1:
    ans = 0
    
elif h == 1 or w == 1:
    ans = 2
    
else:
    ans = 2*(h-2)+2*(w-2)+4
ans = (h*w) - ans
print(ans)
# Judge status: Accepted
a, b, c, d = map(int, input().split())
import fractions
lcm = c * d // fractions.gcd(c, d)
a_count = (a-1)//c + (a-1)//d - (a-1)//lcm
b_count = b//c + b//d - b//lcm
answer = b_count - a_count
print(b - a + 1 - answer)
# Judge status: Accepted
n,m = map(int,input().split())
lis = [list(map(int,input().split())) for i in range(n)]
lis.sort()
cnt = 0
mon = 0
i = 0
if n >= 2:
    while cnt < m:
        if lis[i][1] + cnt < m:
            cnt += lis[i][1]
            mon += lis[i][0]*lis[i][1]
            i += 1
        else:
            break
    print(mon + (m-cnt) * lis[i][0])
else:
    print(m*lis[0][0])
# Judge status: Accepted
# 動的計画法による解法

s = int(input())
mod = pow(10, 9) + 7

A = [0] * (s + 1)

if s >= 3:
    A[3] = 1

for i in range(4, s + 1):
    A[i] = (A[i - 3] + A[i - 1]) % mod

print(A[s])
# Judge status: Accepted
n=int(input())
l=list(map(int, input().split()))
# n=5
# l=[4,2,5,1,3]
count=0

import heapq

tmp=l[0]
for i in range(1,len(l)+1):
    if tmp>=l[i-1]:
        count+=1
        tmp=l[i-1]
    
    
print(count)
# Judge status: Wrong Answer
A,B=map(int,input().split())
if A>=B:
    print(1)
else:
    print(B//A+1)
# Judge status: Accepted
import math
print(math.floor(math.sqrt(int(input())))**2)
# Judge status: Wrong Answer
a, b=list(map(int, input().split()))
big = 0
small =0
if a > b:
  big = a
  small = b
else:
  big = b
  small = a
  
s = ""
for i in range(b):
  s += str(small)

print(s)
# Judge status: Accepted
n = int(input())
input_line = list(map(int, input().split()))
data = [0 for i in range(n)]

for i in range(len(input_line)):
  data[input_line[i]-1] += 1

for i in data:
  print(i)
# Judge status: Accepted
a,b,c = map(int,input().split())
ans = 0
for i in range(10000001):
  if a%2 == 1 or b%2 == 1 or c%2 == 1:
    break
  if i == 1000000:
    print(-1)
    exit()
  m = a
  n = b
  l = c
  a = (b+c)//2 
  b = (c+m)//2 
  c = (m+n)//2
  ans += 1
print(ans)
# Judge status: Accepted
A,B=map(int,input().split())
if A>12:
    print(B)
elif A>5:
    print(B//2)
else:
    print(B*0)
# Judge status: Accepted
n,k=map(int,input().split())
if n%k==0:
    print(0)
else:
    print(1)
# Judge status: Wrong Answer
A = int(input())
B = int(input())
C = int(input())
X = int(input())
A_max = X // 500
count = 0
for i in range(A_max + 1):
    for j in range(B + 1):
        for h in range(C + 1):
            if i * 500 + j * 100 + h * 50 == X:
                count += 1
print(count)
# Judge status: Accepted
from math import factorial as frac

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

MOD = 10**9 + 7

def nPk(n, k):
    r = 1
    while k > 0:
        r *= n
        r %= MOD
        n -= 1
        k -=  1
    return r

if abs(N-M) > 1:
    print(0)
elif N==M:
    print(((nPk(N,N)*nPk(M,M))*2)%MOD)
else:
    print(nPk(N,N)*nPk(M,M)%MOD)
# Judge status: Wrong Answer
a, b = map(int, input().split())
roota = int(a ** 0.5)
pa = []
for i in range(2, roota + 1):
    if a % i == 0:
        pa.append(i)
        while a % i == 0:
            a //= i
cd = []
for i in range(len(pa)):
    if b % pa[i] == 0:
        cd.append(pa[i])
print(len(cd) + 1)
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-
a,b,c = map(int, input().split())
cnt = 0
if a != b:
  cnt += 1
if a != c:
  cnt += 1
if b != c:
  cnt += 1
print(int(cnt))
# Judge status: Accepted
s = str(input())

if len(s) == len(set(s)):
    print("yes")
else:
    print("no")
# Judge status: Accepted
def f(m):
    return 0 if m < 2 else m * (m-1) // 2

def solve(n, a):
    D = {}
    for x in a:
        if not x in D:
            D[x] = 0
        D[x] += 1
    total = 0
    for x, num in D.items():
        total += f(num)
    for x in a:
        num = D[x]
        print(total - f(num) + f(num-1))

n = int(input())
a = list(map(int, input().split()))
solve(n, a)
# Judge status: Accepted
from collections import defaultdict
N, K = map(int, input().split())
r, s, p = map(int, input().split())
score = {}
score['s'] = r
score['p'] = s
score['r'] = p
T = input()
dic = defaultdict(int)
ans = 0
for i in range(N):
  c = T[i]
  if i<K:
    ans += score[c]
    dic[i] = c
    continue
  d = dic[i%K]
  if d==c:
    dic[i%K] = 0
    continue
  ans += score[c]
  dic[i%K] = c
print(ans)
# Judge status: Accepted
s = input()

print(s.rfind('Z') - s.index('A') + 1)
# Judge status: Accepted
H, N = map(int, input().split())
magics = [tuple(map(int, input().split())) for _ in range(N)]
maxA = max([x for x, y in magics])

dp = [10**18]*(H+maxA+1)
dp[0] = 0

for i in range(1, H+maxA+1):
    for j in range(N):
        a, b = magics[j]
        if a<=i:
            dp[i] = min(dp[i-a]+b, dp[i])

print(min(dp[H:]))
# Judge status: Accepted
N,M=map(int,input().split())
B=[1]+[1]+[0]*(N-1)
for j in range(M):
    a=int(input())
    B[a]=-1
    if a==1:
        B[a]=0
i=2
while i<=N:
    if B[i]==-1:
        B[i]=0
    else:
        B[i] = (B[i - 1] + B[i - 2]) % (10 ** 9 + 7)
    i+=1
print(B[N])
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
if c <= a <= b:
  print('YES')
else:
  print('NO')
# Judge status: Wrong Answer
x,y=map(int,input().split())
citylist=[[] for x in range(x)]
inputlist=[]
arucity=set()
for a in range(y):
    s,t=map(int,input().split())
    citylist[s-1].append(t)
    inputlist.append(s)
    inputlist.append(t)
    arucity.add(s)
for a in arucity:
    citylist[a-1].sort()
for b in range(y):
    e=inputlist.pop(0)
    print("{:08} {:08}".format(e,(citylist[e-1].index(inputlist.pop(0))+1)))
# Judge status: Accepted
a , b  = map(int,input().split())
print(min(str(a) * b ,str(b) * a))
# Judge status: Wrong Answer
I = input()
import re
# if re.match("^(a|i|u|e|o){1}$", I):
# if I in 'aiueo':
if 'aiueo'.find(I):
    print('vowel', flush=True)
else:
    print('consonant', flush=True)
# Judge status: Accepted
n = int(input())
s = input()

curr_change_cnt = min_change_cnt = sum(c == 'E' for c in s[1:])
for i in range(1, n):
    if s[i - 1] == 'W':
        curr_change_cnt += 1

    if s[i] == 'E':
        curr_change_cnt -= 1

    min_change_cnt = min(curr_change_cnt, min_change_cnt)

print(min_change_cnt)
# Judge status: Accepted
n, m = map(int, input().split())
ans = [0] * m
G = [[] for _ in range(n + 1)]
for i in range(m):
    p, y = map(int, input().split())
    G[p].append([y, i])
for i in range(1, n + 1):
    g = G[i]
    g.sort()
    for j in range(len(g)):
        f = g[j]
        s = ["0"] * (6 - len(str(i))) + [str(i)]
        t = ["0"] * (6 - len(str(j + 1))) + [str(j + 1)]
        ans[f[1]] = "".join(s + t)
for i in ans:
    print(i)
# Judge status: Wrong Answer
A,B,C,D=map(int,input().split())
print(A,B,C,D)

from fractions import*
upto_B=B-(B//C+B//D-B//(C*D//gcd(C,D)))
upto_A=A-1-((A-1)//C+(A-1)//D-(A-1)//(C*D//gcd(C,D)))

print(upto_B-upto_A*(A>2))
# Judge status: Wrong Answer
from collections import defaultdict
import numpy as np

n = int(input())
p = np.array(list(map(int, input().split())))

comp = np.arange(n) + 1
diff = comp - p


memo = defaultdict(int)
memo[0] = 0

cnt = 0
for x in diff:
    if x == 0:
        cnt += 1
    else:
        memo[cnt] += 1
        cnt = 0

if np.any(diff) == False:
    memo[diff.shape[0]] += 1

remove = memo.pop(0)

if memo[1] != 0:
    ans = memo.pop(1)
else:
    ans = 0

for k, v in memo.items():
    ans += (k - 1) * v

print(ans)
# Judge status: Accepted
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

N, K = map(int, input().split())
print(N*K)
# Judge status: Accepted
n,d = map(int,input().split())
print(-(-n//(d*2+1)))
# Judge status: Accepted
N,A,B = [ int(i) for i in input().split() ]
S = input()

passCount = 0
overseaPassCount = 1
for k,v in enumerate(S):
  if v == "c":
    print("No")
  elif v == "b":
    if passCount<A+B and overseaPassCount<=B :
      print("Yes")
      overseaPassCount += 1
      passCount += 1
    else:
      print("No")
  elif v == "a":
    if passCount<A+B :
      print("Yes")
      passCount += 1
    else:
      print("No")

  else :
    None
# Judge status: Accepted
import numpy as np

n, m, x = map(int, input().split())
books = [list(map(int, input().split())) for _ in range(n)]

ans = float('inf')
for i in range(2 ** n):
    cost = 0
    exp = np.array([0] * m)
    for j , b in enumerate(books):
        if i >> j & 1: continue
        cost += b[0]
        exp = exp + np.array(b[1:])
    if (exp < x).any(): continue
    ans = min(cost, ans)

if ans == float('inf'): ans = -1
print(ans)
# Judge status: Accepted
import sys
import collections


input = sys.stdin.readline


def main():
    N = int(input())

    C = []

    for i in range(N):
        S = input().strip()
        C.append(collections.Counter(S))

    for i in range(26):
        m = float("inf")
        for j in range(N):
            m = min(m, C[j][chr(ord('a') + i)])

        if m != float("inf"):
            print(chr(ord('a') + i) * m, end="")

    print()
    

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N = int(input())
ans = 0
for i in range(1, N, 2):
    c = 0
    for j in range(1, N+1):
        if i%j==0:
            c += 1
    if c==8:
        ans += 1
print(ans)
# Judge status: Accepted
n, k, q = list(map(int, input().split()))

collect = [0] * (n+1)
for i in range(q):
    p = int(input())
    collect[p] += 1

for j in range(1, n+1):
    if k - (q - collect[j]) > 0:
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
from numba import jit
n = int(input())
@jit
def main(n):
    ans = 0
    for i in range(1, n+1):
        ans += i * (n//i) * (n//i + 1) //2
    print(ans)
main(n)
# Judge status: Accepted
A,B,C,K = map(int,input().split())

S = A+B+C
d = A-B

if d > pow(10,18):
  print("unfair")
  exit()
if K%2 == 0:
  print(d)
else:
  print(-d)
# Judge status: Accepted
H = int(input())
W = int(input())
N = int(input())

s = 0
c = 0

while s < N:
    if H < W:
        s += W
        H -=1
    else:
        s += H
        W -=1
    c += 1

print(c)
# Judge status: Accepted
n, m = map(int, input().split())
N = [1]*n
P = [True] + [False]*(n-1)
for i in range(m):
    x, y = list(map(lambda tmp: tmp-1, map(int, input().split())))
    P[y] = True if P[x]==True else P[y]
    N[x] -= 1
    N[y] += 1
    P[x] = False if N[x]==0 else P[x]
print(sum(P))
# Judge status: Wrong Answer
def main():
    n = int(input())
    word_lst = [""] * n
    previous_word = input()
    ok = True
    for i in range(1,n):
        now_word = input()
        if not (now_word[0] == previous_word[-1]):
            ok = False
            break

    print("Yes" if ok else "No")






if __name__ == '__main__':
    main()
# Judge status: Accepted
a,b=map(int,input().split())
if 0<a<10 and 0<b<10:
  print(a*b)
else:
  print(-1)
# Judge status: Accepted
n = int(input())
List = list(map(int,input().split()))
List = sorted(List)
a_j = List[-1]
checker = a_j
a_i = a_j
for item in List:
  temp = abs(a_j/2 - item)
  if temp < checker:
    checker = temp
    a_i = item
Answer = [a_j, a_i]
print(*Answer)
# Judge status: Accepted
x = int(input())
a = 0
if 400 <= x <= 599:
    a = 8
if 600 <= x <= 799:
    a = 7
if 800 <= x <= 999:
    a = 6
if 1000 <= x <= 1199:
    a = 5
if 1200 <= x <= 1399:
    a = 4
if 1400 <= x <= 1599:
    a = 3
if 1600 <= x <= 1799:
    a = 2
if 1800 <= x <= 1999:
    a = 1

print(a)
# Judge status: Accepted
from sys import stdin, stdout

N, K = map(int,stdin.readline().rstrip().split())

ans = N % K
print(min(ans,abs(ans - K)))
# Judge status: Accepted
s=input()
t=input()

max=0
count=0
for i in range(len(s)-len(t)+1):
    count=0
    for j in range(len(t)):
        if s[i+j]==t[j]:
            count+=1
    if count > max:
        max=count
        
print(len(t)-max)
# Judge status: Accepted
import sys
import os

MOD = 2019


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    L, R = list(map(int, sys.stdin.readline().split()))
    ret = float('inf')

    if R - L >= 2019:
        print(0)
        exit()

    for i in range(L, R+1):
        for j in range(i+1, R+1):
            ret = min(ret, (i * j) % MOD)

    print(ret)


if __name__ == '__main__':
    main()
# Judge status: Accepted
from fractions import gcd


def invmod(j):
    return pow(j, MOD - 2, MOD)


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

MOD = 10 ** 9 + 7


l = 1
ans = 0
for i in range(N):
    g = gcd(l, A[i])
    multip = A[i] * invmod(g) % MOD
    l *= multip
    ans *= multip
    ans += l * invmod(A[i]) % MOD
    ans %= MOD

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

print(ans)
# Judge status: Accepted
x = int(input())

rest = x
ureshisa = 0

ureshisa += (rest // 500) * 1000
rest = rest % 500

ureshisa += (rest // 5) * 5

print(ureshisa)
# Judge status: Accepted
a, b = map(int, input().split())
s = input()

if s[:a].isnumeric() and s[a+1:].isnumeric() and s[a] == '-':
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n = int(input())
a = []
for _ in range(n):
    c0, c1 = map(int, input().split())
    a.append([c0-c1, c0+c1])
a.sort(key=lambda x: x[1])
ans, b = 1, a[0][1]
for i in a[1:]:
    if b <= i[0]:
        b = i[1]
        ans += 1
print(ans)
# Judge status: Wrong Answer
print("YES" if input() in "357" else "No")
# Judge status: Accepted
from operator import itemgetter

def id(n):
    if len(str(n)) >= 6:
        return str(n)
    return "0"*(6-len(str(n)))+str(n)

n,m = map(int,input().split())
data = [[] for i in range(n+1)]
for i in range(m):
    p,y = map(int,input().split())
    data[p].append((i,y))
ans = []
for i in range(n+1):
    if data[i]:
        data[i].sort(key=itemgetter(1))
        for j in range(len(data[i])):
            ans.append((data[i][j][0],id(i)+id(j+1)))
ans.sort()
for i,j in ans:
    print(j)
# Judge status: Accepted
N = int(input())
L = sorted(list(map(int, input().split())))
if L[-1] < sum(L[:-1]):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
a, b ,c = map(int, input().split())
count = 0
if a!=b:
  count+=1

if b!=c:
  count+=1

if a!=c:
  count+=1

if count==1:
  print(1)
  
else:
  print(count)
# Judge status: Wrong Answer
T={'Sunny':'Cloudy','Cloudy':'Rainy','Rainy':'Sunny'}
print(input(T))
# Judge status: Wrong Answer
w,a,b = map(int,input().split())
c = b - a
if c - w > 0:
    print(c - w)
else:
    print("0")