peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
N = int(input())
S = input()
direction = [{"E": 0, "W": 0} for _ in range(N + 1)]  # direcion[i]["E"] ... i番目までにEを向いている人数
ans = N
for i in range(N):
    direction[i + 1]["E"] = direction[i]["E"] + (1 if S[i] == "E" else 0)
    direction[i + 1]["W"] = direction[i]["W"] + (1 if S[i] == "W" else 0)
for i in range(N):
    ans = min(ans, direction[i]["W"] + direction[N]["E"] - direction[i]["E"])
print(ans)
# Judge status: Accepted
n,k = map(int, input().split())
s = input()

print(s[:k-1]+s[k-1].lower()+s[k:])
# Judge status: Wrong Answer
from collections import deque
import sys

n = int(input())

ab = []
for _ in range(n):
	ab.append(list(map(int,input().split())))

ab = sorted(ab, key=lambda x:x[1], reverse=True)

d = []
d = deque(d)

while len(ab) > 0:
	d = deque([])
	d.append(ab.pop())
	while True:
		if len(ab) == 0:
			break
		if ab[-1][1] == d[0][1]:
			d.append(ab.pop())
		else:
			break
	num = 0
	for i in range(len(d)):
		a,b = d.pop()
		num += a
	if num > b:
		print('No')
		sys.exit()

print('Yes')
# Judge status: Accepted
N=int(input())
X=list(map(int,input().split()))
p=round(sum(X)/len(X))
ans=0
for i in range(len(X)):
    ans+=(X[i]-p)**2
print(ans)
# Judge status: Accepted
S=input()
c=[]
for i in range(len(S)-2):
  r=abs(753-(100*int(S[i])+10*int(S[i+1])+int(S[i+2])))
  c.append(r)
  
print(min(c))
# Judge status: Wrong Answer
s=input() 
ans=0
for i in range(0,len(s),2):
  if s[i]!='R' and s[i]!='U'  and s[i]!='D':
    ans=1
for j in range(1,len(s),2):
  if s[i]!='U' and s[i]!='L' and s[i]!='D':
    ans=1
if ans==0:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
from heapq import heapify,heappush,heappop

def main():
    N,M = map(int,input().split())
    A = [-x for x in map(int,input().split())]
    heapify(A)
    for i in range(M):
        tmp = heappop(A)
        tmp2 = tmp//2
        heappush(A,tmp2)
    ans = 0
    for i in range(N):
        ans += A[i]

    ans = abs(ans)
    return ans

print(main())
# Judge status: Accepted
n, m, k = map(int, input().split())
for nn in range(n+1):
    for mm in range(m+1):
        if nn*m+n*mm-2*nn*mm==k:
            print('Yes')
            break
    else:
        continue
    break
else:
    print('No')
# Judge status: Accepted
x = int(input())

ans = 1
for i in range(2, x):
    if i * i > x:
        break

    now = i
    while now * i <= x:
        now *= i
    if now > ans:
        ans = now

print(ans)
# Judge status: Wrong Answer
n,q = map(int, input().split())
s = input()
a = [0]*n
for i in range(1,n):
    a[i] = a[i-1]
    if (s[i]=="C"):
        if (s[i-1]=="A"):
            a[i] += 1
print(a)
for i in range(q):
    l,r = map(int, input().split())
    print(a[r-1]-a[l-1])
# Judge status: Accepted
n,a,b=map(int,input().split())
m=n//(a+b)
c=n-m*(a+b)
if c<=a:
  print(m*a+c)
else:
  print(m*a+a)
# Judge status: Accepted
h = int(input())
w = int(input())
n = int(input())

print(n//max(h,w) if n%max(h,w)==0 else n//max(h,w)+1)
# Judge status: Accepted
n, k = map(int, input().split())
res = 0
divnum = 10 ** 9 + 7
for i in range(k, n + 2):
  res += i * (n - i + 1) + 1
  res %= divnum
print(res)
# Judge status: Wrong Answer
w,a,b = map(int, input().split())

if a+w < b:
    print(b-(a+w))
elif a<=b<=a+w:
    print(0)

if b+w < a:
    print(a-(b+w))
elif a<=b+w<=a+w:
    print(0)
# Judge status: Wrong Answer
# !/use/bin/python3

"""
https://atcoder.jp/contests/abc151/tasks/abc151_a
Next Alphabate
"""

def solve(c):
    print(c)
    ans = ord(c)
    return chr(ans+1)

if __name__ == "__main__":
    c = input()
    print(solve(c))
# Judge status: Accepted
MOD=10**9+7
N=int(input())

answer=1
for i in range(2,N+1):
  answer*=i
  answer%=MOD

print(answer)
# Judge status: Accepted
N = int(input())
A = [list(map(int, input().split())) for _ in range(2)]

print(max([sum(A[0][:j+1]) + sum(A[1][j:]) for j in range(N)]))
# Judge status: Wrong Answer
S = str(input())
N = len(S)

def f():
    for erase in range(2, N + 1):
        new = S[0 : N - erase]
        if len(new) % 2 == 1: continue
        flg = 1
        for i in range((N - erase) // 2):
            if new[i] != new[(N - erase) // 2 + i]: flg = 0
            break
        if not flg: continue
        return len(new)

print(f())
# Judge status: Wrong Answer
s = list(set(list(input())))

if len(s)%2 == 0:
    if ("N" in s and"S" in s) or ("E" in s and "W" in s):
        print('Yes')
else:
    print('No')
# Judge status: Accepted
s = int(input())
A = []
A.append(s)


def has_duplicates(seq):
	return len(seq) != len(set(seq))
itr = 1
while True:
	#print(itr,A)
	itr += 1
	if A[-1] % 2 == 0:
		A.append(int(A[-1] / 2))
	else:
		A.append(int(3*A[-1]+1))
	#print(A)
	if has_duplicates(A):
		print(itr)
		break
# Judge status: Accepted
s = input()
for i in range(7):
    if s[:i] + s[-7 + i:] == "keyence":
        print("YES")
        exit()
print("NO")
# Judge status: Wrong Answer
N, K = map(int, input().split())
A = list(map(int, input().split()))
temp = 1
count = 0
ans = 0

dict_num = {}
set_num = set()

for _ in range(K):
  count += 1
  temp = A[temp-1]
  if temp in set_num:
    dict_num[temp] += 1
    if dict_num[temp] == 3:
      break
  else:
    dict_num[temp] = 1
    set_num.add(temp)
    continue
else:
  ans = temp


if count == K:
  pass
else:
  count = count - list(dict_num.values()).count(1) -1
  mod = K % count
  for _ in range(mod + 1):
    temp = A[temp-1]
  else:
    ans = temp
  
print(ans)
# Judge status: Wrong Answer
n, m = map(int, input().split())
a = list(map(int, input().split()))

a.sort(reverse = True)

for i in range(m):
    a[0] = a[0] // 2
    if sum(a) == 0:
        break
    for j in range(1, n):
        if a[0] < a[j]:
            a[0], a[j] = a[j], a[0]
            break
print(sum(a))
# Judge status: Wrong Answer
a, b = map(int, input().split())
n = a * b
if n == 0:
  print(0)
elif n > 0:
  print('Positive')
else:
  print('Negative')
# Judge status: Accepted
n = int(input())
s = list(input())
t = list(input())
count = 0
for i in range(n, 0, -1):
    if s[-i:] == t[:i]:
        count = i
        break
print(2 * n - count)
# Judge status: Wrong Answer
r, g, b = map(int,input().split())

if (r * g * b) % 4 == 0:
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
p,q,r=map(int,input().split())
if p+q<=q+r and p+q<=p+r:
    print(p+q)
if p+r<=p+q and p+r<=q+r:
    print(p+r)
if q+r<=p+r and q+r<=p+q:
    print(q+r)
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline

N, M = map(int, input().split())
PY = [tuple(map(int, input().split())) for _ in range(M)]

city_count = [0]*(N+1)
for p, y in PY:
    city_count[p] += 1
for ken, count in enumerate(city_count):
    [print(str(1*10**12+ken*10**6+i)[1:]) for i in range(1,count+1)]
# Judge status: Accepted
import math

n = int(input())
top_bottom_num = {str(i): {str(j): 0 for j in range(10)} for i in range(10)}
for i in range(1, n + 1):
    str_num = str(i)
    top_bottom_num[str_num[0]][str_num[-1]] += 1
ans = 0
for i in range(10):
    for j in range(10):
        i_j = top_bottom_num[str(i)][str(j)]
        j_i = top_bottom_num[str(j)][str(i)]
        ans += i_j * j_i
print(ans)
# Judge status: Accepted
a,b=map(int,input().split())
if a==1:a=14
if b==1:b=14
if a>b:print("Alice")
elif a<b:print("Bob")
else:print("Draw")
# Judge status: Wrong Answer
a = list(input().split())
n = len(a)
for i in range(n):
  a[i] = "x"
print(a)
# Judge status: Accepted
n = int(input())
A = list(map(int, input().split()))

MAX_N = max(A)+ 1
cnt = [0] * MAX_N
for a in A:
    for i in range(a, MAX_N, a):
        if cnt[i] <= 2: 
            cnt[i] += 1
            
ans = 0
for a in A:
    if cnt[a] == 1:
        ans += 1
print(ans)
# Judge status: Accepted
n = int(input())

cnt = 0
for i in range(1, n + 1):
    cnt += i
    if cnt >= n:
        ans, exc = i, cnt - n
        break

for j in range(1, ans + 1):
    if exc != j:
        print(j)
# Judge status: Accepted
from collections import Counter

input()
d = Counter(map(int, input().split()))
d = dict(sorted(d.items(), reverse=True))
ans = []
for i, j in d.items():
    if j >= 4:
        ans.append(i)
    if j >= 2:
        ans.append(i)
    if len(ans) >= 2:
        print(ans[0] * ans[1])
        break
else:
    print(0)
# Judge status: Accepted
h, n = map(int, input().split())
if h <= sum(list(map(int, input().split()))):
  print('Yes')
else:
  print('No')
# Judge status: Accepted
nums = list(input().split())

if nums.count('5') == 2 and nums.count('7') == 1:
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
c=0
n=int(input())
for i in range(n):
    if i**2<=n:c=i**2
print(c)
# Judge status: Wrong Answer
a,b,c,x,y=map(int,input().split())

if x>y:
  print(min(2*x*c,2*y*c+(x-y)*a,a*x+b*y))
else:
  print(min(2*y*c,2*x*c+(y-x)*a,a*x+b*y))
# Judge status: Accepted
s = input()

k = 'keyence'

for i in range(len(s)):
    for j in range(i, len(s)):
        t = s[:i] + s[j:]
        if k == t:
            print('YES')
            exit()

print('NO')
# Judge status: Accepted
s = input()
mmyy = (1 <= int(s[:2]) <= 12)
yymm = (1 <= int(s[2:]) <= 12)
if mmyy:
  if yymm:
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if yymm:
    print('YYMM')
  else:
    print('NA')
# Judge status: Accepted
N,x = map(int,input().split())
a = map(int,input().split())
ret = 0
for i,n in enumerate(sorted(a)):
  if i == N-1 and n == x:
    x -= n
    ret += 1
  elif i < N-1 and n <= x:
    x -= n
    ret += 1
  else:
    break
print(ret)
# Judge status: Wrong Answer
n,m = map(int,input().split())
stair = []
for i in range(m):
    stair.append(int(input()))

ans = [0]*(n+1)
ans[0] = 1
ans[1] = 1
for i in range(n+1):
    if i==0:
        continue
        
    elif i in stair:
        ans[i] = 0
    else:
        ans[i] = ans[i-2] + ans[i-1]
print(ans[n]%1000000007)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
Q = int(input())

data = [0] * 100001

def my_sum(d):
    retval = 0

    for i in range(len(d)):
        if d[i] == 0:
            continue
        retval += d[i] * i
    return retval

for i in A:
    data[i] += 1

sum_val = my_sum(data)

for i in range(Q):
    B, C = map(int,input().split())

    sum_val = sum_val - (data[B] * B) + ((data[C] + data[B]) * C)

    data[C] += data[B]
    data[B] = 0

    print(sum_val)
# Judge status: Wrong Answer
N = int(input())
al = list(map(int, input().split()))

print(-1)
exit()

al = [0] + al # 1-index
multi_cnts = [0]*(N+1)
ans = []
for n in range(N,0,-1):
    if multi_cnts[n] != al[n]:
        ans.append(n)
        for i in range(2, int(-(-n**0.5//1))+1):
            if n%i == 0:
                multi_cnts[i]+=1
                multi_cnts[i]%=2


print(len(ans))
if ans: print(*ans)
# Judge status: Wrong Answer
S = list(input())

cnt = 0
a = S[0]

for i in range(1,len(S)):
  if S[i] != a:
    cnt += 1
    if S[i] == "1":
      a = "0"
    else:
      a = "1"
  else:
    a = S[i]
    
print(int(cnt))
# Judge status: Accepted
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    A, B = map(int, readline().split())
    print((B - 1 + A - 1 - 1) // (A - 1))

    return


if __name__ == '__main__':
    main()
# Judge status: Accepted
N = int(input())
A = [int(input()) for _ in range(N)]
ans = 0
if 0 not in A:
  ans = sum(A)//2
else:
  now = 0
  for i in range(N):
    if A[i] == 0 or i == N-1:
      ans += sum(A[now:i+1])//2
      now = i+1
print(ans)
# Judge status: Accepted
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    L=LI()
    if L[2]==(sum(L) - min(L) - max(L)):
        print("Yes")
    else:
        print("No")

main()
# Judge status: Accepted
x = input().split()
 
a = int(x[0])
b = int(x[1])
k = int(x[2])
 
if(a-k > 0):
  print(a-k,b)
  exit()
elif(a-k == 0):
  print(0,b)
  exit()
elif(a-k < 0 and b-(k-a) > 0):
  print(0,b-(k-a))
  exit()
elif(a-k < 0 and b-(k-a) == 0):
  print(0,0)
  exit()
elif(a-k < 0 and b-(k-a) < 0):
  print(0,0)
  exit()
# Judge status: Wrong Answer
l = [int(input()) for _ in range(5)]

ans = 0
min_div = 10
for i in l:
  ans += 10 * (i + 10 - 1) //10
  if i % 10 != 0:
  	min_div = min(min_div, i % 10)
print(ans - (10 - min_div))
# Judge status: Wrong Answer
X, Y = map(int, input().split())
print((X+Y)/2)
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))

ans = []
over = 0
for i in range(N):
  n = a[i] // 400
  if n < 8:
    if n not in ans:
      ans.append(n)
  else:
    over += 1
    
cnt = len(ans) + over
if len(ans) > 0:
  print(len(ans), cnt)
else:
  print(1, cnt)
# Judge status: Accepted
import math
import sys
import os
from operator import mul

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")

a,b,x = LI()

ans = 0
if a > 0:
    a -= 1
else:
    ans += 1
ans += b//x - a//x

print(ans)
# Judge status: Wrong Answer
N = int(input())
N_List = sorted(list(map(int,input().split())), reverse=True)
S_a = 0
S_b = 0
for i in range(N):
    if S_a <= S_b:
        S_a += N_List[i]
    else:
        S_b += N_List[i]
print(abs(S_a-S_b))
# Judge status: Accepted
input = input()

nums = input.split(" ")

for index, num in enumerate(nums):
    if int(num)==0:
        print(index+1)
# Judge status: Accepted
a = int(input())
b = int(input())
c = int(input())
x = int(input())

cnt = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            ans = i*500 + j*100 + k*50
            if ans == x:
                cnt += 1

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

for i in range(K):
    if A > B:
        B *= 2
    else:
        C *= 2

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

n = x
ans = 0

while n <= y:
    n *= 2
    ans += 1

print(ans)
# Judge status: Accepted
import itertools
import math
import sys
from collections import Counter
from fractions import gcd
from functools import reduce

n, start = map(int, input().split())
x = list(map(int, input().split()))
x.append(start)
x.sort()
# print(x)
gaps = []
for i in range(n):
    gaps.append(x[i + 1] - x[i])
# print(gaps)
if len(gaps) == 1:
    print(gaps[0])
else:
    ans = reduce(gcd, gaps)
    print(ans)
# Judge status: Accepted
import itertools
N = int(input())

if N > 81:
  print('No')
  exit()

for i,j in itertools.product(range(1,10),range(1,10)):
  if i*j == N:
    print('Yes')
    exit()
    
print('No')
# Judge status: Accepted
# python 3.4.3
import sys
input = sys.stdin.readline
import numpy as np

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
A,B = map(int,input().split())

print(max(A+max(A-1,B), B+max(A,B-1)))
# Judge status: Wrong Answer
S = input()
results = True
while results:
    for key_word in ["erase", "eraser", "dream", "dreamer"]:
        if S.endswith(key_word):
            S = S[:-len(S)]
            continue
    if S == '':
        print("YES")
        results = False
        break
    else:
        print("NO")
        results = False
        break
# Judge status: Accepted
N, M, K = map(int, input().split())

ans = 0
for n in range(N + 1):
    for m in range(M + 1):
        black = n * (M - m) + m * (N - n)
        if black == K:
            print('Yes')
            exit()
print('No')
# Judge status: Wrong Answer
mod = 10 ** 9 + 7
x, y = map(int,  input().split())

def nCm_mod(A, B, mod):
    mul_one = 1
    mul_two = 1

    for i in range(B):
        mul_one *= A - i
        mul_two *= i + 1
        mul_one %= mod
        mul_two %= mod
    
    return (mul_one * pow(mul_two, mod-2, mod)) % mod

if (x + y) % 3 != 0:
    print(0)
else:
    n = (2 * y - x) // 3
    m = (2 * x - y) // 3

    comb_num = nCm_mod(n+m, min(n,m), mod)
    print(comb_num)
# Judge status: Wrong Answer
import math

A,B,H,M = map(int, input().split())

degH = H*360/12 + M*360/12/60
degM = M*360/60

angle = abs(degH-degM)

dist = 0
if angle == 0:
  dist = 0
else:
  dist = (A**2 + B**2 - 2*A*B * math.cos(math.radians(angle)))**(1/2)

print(dist)
# Judge status: Wrong Answer
A, B, C = map(int, input().split())
result1 = A + B*10 + C
result2 = A*10 + B + C

print(max(result1, result2))
# Judge status: Accepted
import sys
nun_list = list(map(int, input().split()))
count=1
for i in nun_list:
    if i == 0:
        print(count)
        sys.exit()
    count+=1
# Judge status: Wrong Answer
K=int(input())
print(((K/2)/2)*((K+1)/2))
# Judge status: Accepted
a, b = map(int, input().split())

if 13 <= a:
    print(b)
elif 6 <= a:
    print(b // 2)
else:
    print(0)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
for i in range(n):
    a[i]-=(i+1)
# print(a)
a.sort()
# print(a)
s = 0
for i in a:
    s += abs(i)
if abs(a[(n-1)//2]) > abs(a[n//2]):
    t = a[(n-1)//2]
else:
    t = a[n//2]
ans = 0
for i in a:
    ans += abs(i-t)
# print(t)
print(ans)
# Judge status: Accepted
def main():
    A,B,C=map(int,input().split())
    ans=0
    tmp=set()
    while A%2==0 and B%2==0 and C%2==0:
        A,B,C=(B+C)//2,(C+A)//2,(A+B)//2
        if (A,B,C) in tmp:
            print(-1)
            exit()
        else:
            tmp.add((A,B,C))
        ans += 1
    print(ans)

main()
# Judge status: Accepted
import math
a,b,c,d= map(int,input().split())
i = math.ceil(c/b)
j = math.ceil(a/d)
if i <= j:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
k, n = map(int, input().split())
a = list(map(int, input().split()))

a += [a[0] + k]
maxPath = max(b - a for a,b in zip(a,a[1:]))
print(k - maxPath)
# Judge status: Accepted
N = int(input())
S = []
for _ in range(N):
    S.append(int(input()))
w = sum(S)

if w % 10 != 0:
    print(w)
else:
    S.sort()
    for i in range(N):
        if S[i] % 10 != 0:
            print(w - S[i])
            break
    else:
        print(0)
# Judge status: Wrong Answer
N=int(input())
A=list(map(int,input().split()))
dp=[float("INF")]*(N+1)
dp[0]=0
for i in range(1,N):
  dp[i]=min(dp[i],abs(A[i]-A[i-1]))
print(dp[N-1])
# Judge status: Accepted
from math import gcd
 
k=int(input())
 
ans=0
for i in range(1,k+1):
  for j in range(1,k+1):
    for l in range(1, k+1):
      ans+=gcd(gcd(i,j),l)
 
print(ans)
# Judge status: Accepted
n,m,k = map(int,input().split())

for i in range(n+1):
    for j in range(m+1):
        if i*m-2*i*j+j*n == k:
            print("Yes")
            exit()
print("No")
# Judge status: Accepted
x, y = map(int, input().split())

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

print('No')
# Judge status: Accepted
A, B = map(int, input().split())
flag = 0
for i in range(1300):
  if int(i*0.08) == A and int(i*0.1) == B:
    print(i)
    flag = 1
    break
if flag == 0:
  print(-1)
# Judge status: Wrong Answer
import numpy as np

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

ans = []
point_before = np.prod(a[:k])

for i in range(n-k):
    point = np.prod(a[i+1:k+i+1])
    if point_before < point:
        ans.append('Yes')
    else:
        ans.append('No')
    point_before = point
    # print(point_before)

for a in ans:
    print(a)
# Judge status: Wrong Answer
x, y = map(int,input().split())
#print(x,y)

a = [1,3,5,7,8,12]
#print(a)
b = [4,6,9,11]
c = [2]

if (x in a) and (y in a):
  print("YES")
elif (x in b) and (y in b):
  print("YES")
elif (x in c) and (y in c):
  print("YES")
else:
  print("NO")
# Judge status: Accepted
D=int(input())
c = list(map(int,input().split()))
s=[[0 for e in range(26)] for f in range(D)]
for i in range(D):
 s[i]=list(map(int,input().split()))
last=[0]*26
ans=0
point=[0]*D
for i in range(D):
 saidai=-(10**10)
 kouho=1
 for j in range(26):
  if s[i][j]+c[j]*((i+1)-last[j])>=saidai:
   kouho=j+1
   saidai=s[i][j]+c[j]*((i+1)-last[j])
 print(kouho)
# Judge status: Accepted
if __name__ == "__main__":
    d, t, s = (int(x) for x in input().split())
    if d <= t * s:
        print('Yes')
    else:
        print('No')
# Judge status: Accepted
N,M=map(int,input().split())
ans=0
L,R=0,(10**5)+1
for i in range(M):
    l,r=map(int,input().split())
    L=max(L,l); R=min(R,r)
    if r<l: break
R=min(R,N)
print(abs((L-1)-R) if 0<=R-L else 0)
# Judge status: Wrong Answer
l,r=list(map(int,input().split()))
s=[]
if r-l>2019:
  print(0)
else:
  for i in range(l,r+1):
    s.append(i%2019)
  s.sort()
  print(s[0]*s[1])
# Judge status: Wrong Answer
import os
l = list(map(int,input().split()))
l.sort()
a =l[2]*10+l[1]+l[2]
print(a)
# Judge status: Wrong Answer
def q4():
    X = int(input())
    for i in range(-65, 65):
        for j in range(-65, 65):
            if i**5 - j**5 == X:
                print(i, j)
                return


if __name__ == '__main__':
    q4()
# Judge status: Accepted
from bisect import bisect_left
from collections import deque

n = int(input())
A = [int(input()) for _ in range(n)]

D = deque([])

for a in A:
    i = bisect_left(D, a)
    if i == 0:
        D.appendleft(a)
    else:
        D[i-1] = a

print(len(D))
# Judge status: Accepted
S = input()

if 'A' in S:
  if 'B' in S:
    print('Yes')
  else:
    print('No')
else:
  print('No')
# Judge status: Accepted
x , y = map(int, input().split())
cnt = 0
while x <= y:
    x *=2
    cnt += 1
print(cnt)
# Judge status: Accepted
N=int(input())
 
if N%1000==0:
    print(0)
else:
    ans =1000-(N%1000)
    print(int(ans))
# Judge status: Accepted
s=input()
ans=False
for x in range(len(s)):
    for y in range(x,len(s)):
        if (s[:x]+s[y:])=='keyence':
            ans=True
if ans:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
n,m = map(int,input().split())

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

t.sort()
memo = []
for i in range(m-1):
    memo.append(t[i+1]-t[i])
memo.sort()
#print(memo)
ans = 0
for i in range(m-n):
    #print(i)
    ans += memo[i]
print(ans)
# Judge status: Accepted
x,y=map(int,input().split())
if(x%y==0):
    print('-1')
else:
    print(x)
# Judge status: Accepted
N, K = map(int, input().split())
A = tuple(map(int, input().split()))
T = input()

bestmove = {'r':2, 's':0, 'p':1}

ans = 0
for k in range(K):
    t = T[k::K]
    prev = -1
    for opp in t:
        me = bestmove[opp]
        if prev != me:
            prev = me
            ans += A[me]
        else:
            prev = -1

print(ans)
# Judge status: Wrong Answer
x="AtCoder"+input()+"Contest"

print("A"+x[7]+"C")
# Judge status: Wrong Answer
A,B = map(int,input().split())
if A<=9 and B<=9:
    print()
# Judge status: Wrong Answer
a = input().split()
print(a[0],a[1])
# Judge status: Accepted
S = input()
S_front = S[:2]
S_back = S[2:]

if 0 < int(S_front) < 13:
	if 0 < int(S_back) < 13:
		print("AMBIGUOUS")
	else:
		print("MMYY")
else:
	if 0 < int(S_back) < 13:
		print("YYMM")
	else:
		print("NA")
# Judge status: Accepted
A=int(input())
l=list(input())
mod=10**9+7
import collections
l=list(collections.Counter(l).values())
l=[i+1 for i in l]
ans=1
for i in l:
   ans*=i
   ans%=mod
print(ans-1)
# Judge status: Wrong Answer
N,x = map(int,input().split())
ls = list(map(int,input().split()))
ans = 0
for i in range(N-1):
    if ls[i]+ls[i+1] <= x:
        continue
    else:
        eat = - x + ls[i] + ls[i+1]
        ls[i+1] -= eat
        ans += eat
print(ans)
# Judge status: Accepted
x,y=map(int,input().split())
grp1=[1,3,5,7,8,10,12]
grp2=[4,6,9,11]

if x in grp1 and y in grp1: print("Yes")
elif x in grp2 and y in grp2: print("Yes")
else: print("No")
# Judge status: Wrong Answer
n=int(input())
a=[int(i) for i in input().split()]
x=0
b=[]
for i in a:
  if i<0: x=(x+1)%2
  b.append(abs(i))
b.sort()
print(sum(b)-b[0] if  x else sum(b))