Harryxun/stf_run huggingface dataset:
l,r = map(int, input().split())
gap = r-l

vlist = []

    v = (l+x) % 2019
    vlist.append(v)

vlist.sort()
print(vlist)

#res = i*j % 2019
print(vlist[0]*vlist[1])

### FIXED CODE ###

l,r = map(int, input().split())
gap = r-l
 
vlist = []
mini = 2019
 
for x in range(gap+1):
    v = (l+x) % 2019
    vlist.append(v)
    if v == 0:
        print(0)
        exit()
 
vlist.sort()

mini = 2019

for i in vlist:
    for j in vlist:
        if i==j:
            pass
        else:
            temp = (i*j) %2019
            mini = min(temp, mini)
            if mini == 0:
                print(0)
                exit()

print(mini)
    
#print((vlist[0]*vlist[1])%2019)
#print((vlist[0]*vlist[1])%2019)
if __name__ == '__main__':
    import sys
    input = sys.stdin.readline

    from collections import deque


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

    aa = list(map(int, input().split()))
    aa.sort(reverse=True)
    aa = deque(aa)

    if n == 1:
        a = aa.popleft()
        for _ in range(m):
            a = a // 2
        print(a)
        exit()

    top = aa.popleft()

    deque_list = [aa, deque()]
    top_list = [deque_list[0].popleft(), top//2]


    for _ in range(m-1):
        max_num = max(top_list)
        max_index = top_list.index(max_num)
        try:
            deque_list[max_index+1].append(max_num//2)
        except IndexError:
            deque_list.append(deque())
            top_list.append(max_num//2)
        if top_list[max_index+1] == 0:
            top_list[max_index+1] = deque_list[max_index+1].popleft()
        try:
            top_list[max_index] = deque_list[max_index].popleft()
        except IndexError:
            top_list[max_index] = 0

    ans = sum(top_list)
    for one_deque in deque_list:
        ans += sum(one_deque)
    print(ans)


### FIXED CODE ###

if __name__ == '__main__':
    import sys
    input = sys.stdin.readline

    from collections import deque


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

    aa = list(map(int, input().split()))
    aa.sort(reverse=True)
    aa = deque(aa)

    if n == 1:
        a = aa.popleft()
        for _ in range(m):
            a = a // 2
        print(a)
        exit()

    top = aa.popleft()

    deque_list = [aa, deque()]
    top_list = [deque_list[0].popleft(), top//2]


    for _ in range(m-1):
        max_num = max(top_list)
        max_index = top_list.index(max_num)
        try:
            deque_list[max_index+1].append(max_num//2)
        except IndexError:
            deque_list.append(deque())
            top_list.append(max_num//2)
        if top_list[max_index+1] == -1:
            top_list[max_index+1] = deque_list[max_index+1].popleft()
        try:
            top_list[max_index] = deque_list[max_index].popleft()
        except IndexError:
            top_list[max_index] = -1

    ans = 0
    for num in top_list:
        ans += max(0, num)
    for one_deque in deque_list:
        ans += sum(one_deque)
    print(ans)
def intlist(x):
    y = []
    for i in range(len(x)):
        y.append(int(x[i]))
    return y
 
N, M, X = map(int, input().split())
price = -1
 
L = []
a = []
 
suit =[]
for i in range(M+1):
    a.append(0)

 
for i in range(N):
    text = input().split()
    L.append(intlist(text))
 
def buy(x,y):
    
    if x + y <= N:
        
        for i in range(0,M+1):
            
            a[i] += L[x+y-1][i]
            
        
        if x + y == N:
            score = a[1:len(a)]
            
            if min(score) >= X:
                suit.append(a.copy())
                
        elif x + y != N:
            buy(x+1,y)
            for i in range(0,M+1):
                a[i] -= L[x+y][i]
            
            notbuy(x,y+1)
 
 
def notbuy(x,y):
    print("notbuy",x,y)
    if x + y <= N:
        
        if x + y == N:
            score = a[1:len(a)]
            if min(score) >= X:
                suit.append(a.copy())
                    
                
        elif x + y != N:
            buy(x+1,y)
            for i in range(0,M+1):
                a[i] -= L[x+y][i]
            notbuy(x,y+1)    
 
def textbook(x,y):
    buy(x+1,y)
    for i in range(0,M+1):
        a[i] -= L[x+y][i]
    notbuy(x,y+1)
 
textbook(0,0)
 
b = []
 
if suit != []:
    for i in range(len(suit)):
        for j in range(len(suit)-1):
            if suit[j] > suit[j+1]:
                b = suit[j]
                suit[j] = suit[j+1]
                suit[j+1] = b
    price = suit[0][0]
 
 
print(price)

### FIXED CODE ###

S = input()
T = input()
A = "Yes"

for i in range(len(S)):
    if S[i] != T[i]:
        A = "No"
        break
        
    
print(A)
import math
from collections import defaultdict

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

M= 10**6 +1
S = [1] *M
for i in range(2, M):
    if S[i] == 1:
        for j in range(i, M, i):
            if S[j] == 1:
                S[j] = i

isPairwise = True
f = [0] *M
for i in range(0, N):
    p = S[A[i]]
    if f[p] > 0:
        isPairwise = False
        break
    f[p] += 1

gcd=A[0]
for i in range(1, N):
    gcd = math.gcd(gcd, A[i])
isSetwise = (gcd == 1)

if isPairwise:
    z = 'pairwise coprime'
elif isSetwise:
    z = 'setwise coprime'
else:
    z = 'not coprime'
print(z)


### FIXED CODE ###

from math import gcd

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

# setwise validation
tmp = 0
for a in A:
    tmp = gcd(tmp, a)
isSetwise = (tmp == 1)

# pairwise validation
M = 10 ** 6
sieve = [0] * (M + 1)
for a in A:
    sieve[a] += 1

cnt = 0
isPairwise = True
for i in range(2, M + 1):
    isPairwise &= (sum(sieve[j] for j in range(i, M + 1, i)) <= 1)

# check
if isPairwise:
    ans = 'pairwise coprime'
elif isSetwise:
    ans = 'setwise coprime'
else:
    ans = 'not coprime'
print(ans)
d,t,s=input().split()
if d/s<t :
    print("Yes")
else:
    print("No")

### FIXED CODE ###

d,t,s=map(int,input().split())
if d/s<=t :
    print("Yes")
else:
    print("No")
import numpy as np

n = int(input())
a = np.array([int(x) for x in input().split()])

a1 = list(map(lambda x: bool(x/2%1), a))
a2 = list(map(lambda x: bool(x/3%1), a/2))
a3 = list(map(lambda x: bool(x/5%1), a/2))
a4 = list(map(lambda x, y: x and y, a2, a3))
if a1.count(False) == a4.count(False):
    print("APPROVED")
else:
    print("DENIED"

### FIXED CODE ###

n = int(input())
a = [int(x) for x in input().split()]

a_even = []
for ai in a:
    if ai%2 == 0:
        a_even += [ai]

ans = "APPROVED"
for a_eveni in a_even:
    if a_eveni%3 != 0 and a_eveni%5 != 0:
        ans = "DENIED"
        break

print(ans)
s=raw_input()
K=int(raw_input())
s=list(s)
#a-z 97-122
for i, s_ in enumerate(s):
    if s_!='a':
        if ord(s_)+K >= 123:
            s[i]='a'
            K -= (123-ord(s_))
if K>0:
    asc=ord(s[-1])+K%26
    s[-1]=chr(asc)
print("".join(s))

### FIXED CODE ###

# -*- coding: utf-8 -*-
raw = raw_input()

ans =  raw[:4]+' '+raw[4:]

print ans
import sys
import math
import itertools
import collections
import heapq
import numpy as np

rl = sys.stdin.readline

a, b = map(int, rl().split())

print((a*b)//1)

### FIXED CODE ###

a, b = input().split()
b = b.replace('.', '')
a = int(a)
b = int(b)
print((a*b)//100)
from collections import deque
sys.setrecursionlimit(100000)
n,m =map(int,input().split())
pas = [[] for i in range(n+1)]
for i in range(m):
    a,b = map(int,input().split())
    pas[a].append(b)
    pas[b].append(a)

seen = [False for i in range(n)]
que = deque()
def bfn(i,j):
    if seen[i-1]==False:
        seen[i-1]=j
    for x in pas[i]:
        if seen[x-1]!=False:
            continue
        que.append([x,i])
    if que:
        now,pre =que.popleft()
        bfn(now,pre)
    else:
        return

bfn(1,1)

if False in seen:
    print("No")
else:
    print("Yes")
    for i in range(n-1):
        print(seen[i+1])


### FIXED CODE ###

from collections import deque
import sys
sys.setrecursionlimit(1000000)
n,m =map(int,input().split())
pas = [[] for i in range(n+1)]
for i in range(m):
    a,b = map(int,input().split())
    pas[a].append(b)
    pas[b].append(a)

seen = [False for i in range(n)]
que = deque()
def bfn(i,j):
    for x in pas[i]:
        if seen[x-1]!=False:
            continue
        seen[x-1]=i
        que.append([x,i])
    if que:
        now,pre =que.popleft()
        bfn(now,pre)
    else:
        return

bfn(1,1)

if False in seen:
    print("No")
else:
    print("Yes")
    for i in range(n-1):
        print(seen[i+1])
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

n,t = m()

li = [l() for i in range(n)]

ma = []
for i in range(n):
    ma.append([li[i][1],i])

ma.sort(reverse = True)


t = t-1
dp = [0 for i in range(t + 3000)]

for i in range(n):
    for k in range(li[i][0]+t,li[i][0]-1,-1):
        if dp[k] <= dp[k-li[i][0]] + li[i][1]:
            dp[k] = dp[k-li[i][0]] + li[i][1]


dp.sort(reverse = True)
ans = dp[0]

print(ans)




### FIXED CODE ###

import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

n,t = m()

li = [l() for i in range(n)]

ma = []
for i in range(n):
    ma.append([li[i][1],i])

ma.sort(reverse = True)

li.sort(key = lambda x:x[0])

dp = [0 for i in range(t + 3000)]

for i in range(n):
    for k in range(li[i][0]+t-1,li[i][0]-1,-1):
        if dp[k] <= dp[k-li[i][0]] + li[i][1]:
            dp[k] = dp[k-li[i][0]] + li[i][1]


dp.sort(reverse = True)
ans = dp[0]

print(ans)
import heapq
n,m = map(int,input().split())
l = []
for i in range(n):
  a,b = map(int,input().split())
  l.append([a,b])
l = sorted(l, key=lambda x: (x[0],x[1]))
b = []
heapq.heapify(l)
j = 0
q = 0
for i in range(m):
  key = i+1
  if j >= n+1:
    break
  while j < n:
    if l[j][0] != key:
      break
    heapq.heappush(b,-l[j][1])
    j += 1
  if b != []:
    heapq.heapify(b)
    k = -heapq.heappop(b)
    q += k
print(q)

### FIXED CODE ###

a,b = map(int,input().split())
print(max(a+b,a-b,a*b))
n,r=int(input())
ans=0
if n<10:
  ans=r+r*(10-n)
else:
  ans=r
ptinr(ans)

### FIXED CODE ###

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

ans=0
if n<10:
  ans=r+100*(10-n)
else:
  ans=r
print(ans)
INF = 10**9

H, N = map(int, input().split())
A = []
B = []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)


# i個目までを使って与えた魔力の総和がj以下の時の最小コスト
dp = [[0 for j in range(H + 1)] for i in range(N + 1)]

for i in range(N):
    for j in range(H + 1):
        dp[i + 1][j] = min(dp[i][j], dp[i + 1][j - A[i]] + B[i])
    

print(dp[H][N])

### FIXED CODE ###

INF = float('inf')

H, N = map(int, input().split())
A = []
B = []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)


# i個目までを使って与えた魔力の総和がjの時の最小コスト
dp = [[INF for j in range(H + 1)] for i in range(N + 1)]

dp[0][0] = 0

for i in range(N):
    for j in range(H + 1):
        if j < A[i]:
            dp[i + 1][j] = min(dp[i][j], dp[i + 1][0] + B[i])
        else:
            dp[i + 1][j] = min(dp[i][j], dp[i + 1][j - A[i]] + B[i])

print(dp[N][H])
N, M = list(map(int, input().split()))
S = input()
a = []
for i in range(M):
    a.append(list(map(int, input().split())))
for i in range(M):
  print(S[a[i][0]-1:a[i][1]].count('AC'))

### FIXED CODE ###

b = input()
if b=="A":
  print("T")
elif b=="T":
  print("A")
elif b=="G":
  print("C")
else:
  print("G")
if list(map(int,inpust().split())).sort()==[1,4,7,9]:print("YES")
else:print("NO")

### FIXED CODE ###

a, b, c, d = map(int, input().split())
k = [a, b, c, d]
k.sort()

if [1, 4, 7, 9] == k:
    print("YES")
else:
    print("NO")
s=list(input())
q=int(input())

for i in range(1,q+1):
    q_i=input().split()
    if q_i==["1"]:
        s=s[::-1]
    else:
        if q_i[1]=="1":
            s=list(q_i[2])+s
        else:
            s=s.append(q_i[2])

s="".join(s)
print(s)

### FIXED CODE ###

from collections import deque

s=list(input())
s=deque(s)
q=int(input())

re=False
for i in range(1,q+1):
    q_i=input().split()
    if q_i[0]=="1":
        re= not re
    else:
        if q_i[1]=="1" and re==False:
            s.appendleft(q_i[2])
        elif q_i[1]=="2" and re==True:
            s.appendleft(q_i[2])
        else:
            s.append(q_i[2])

s=list(s)

if re==True:
    s=s[::-1]

s="".join(s)
print(s)
import math
a,b,x=map(int,input().split())
if x<=a*a*b/2:
  ans=90-math.degrees(math.atan(2*x/a/b/b))
else:
  ans=90-math.degrees(math.atan(a*a*a/2/(a*a*b-x)))
print(ans)

### FIXED CODE ###

import math
a,b,x=map(int,input().split())
if x==a*a*b:
  ans=0
elif x<=a*a*b/2:
  ans=90-math.degrees(math.atan(2*x/a/b/b))
else:
  ans=90-math.degrees(math.atan(a*a*a/2/(a*a*b-x)))
print(ans)
from collections import deque

def bfs():
    global ans
    d = [[float("inf")] * w for _ in range(h)]
    que = deque([])
    for i in range(h):
        for j in range(w):
           if A[i][j] == "#":
               que.append((i, j))
               d[i][j] = 0
            
    while que:
        p = que.popleft()
        dx = [1, 0, -1, 0]
        dy = [0, 1, 0, -1]
        i = 0
        while i < 4: 
            nx = p[0] + dx[i]
            ny = p[1] + dy[i]
            if 0 <= nx < w and 0 <= ny < h and A[nx][ny] != "#" and d[nx][ny] == float("inf"):
                d[nx][ny] = d[p[0]][p[1]] + 1
                A[nx][ny] = "#"
                que.append((nx, ny))
            i += 1
    ans = 0
    for i in range(h):
        for j in range(w):
            ans = max(ans, d[i][j])


h, w = map(int, input().split())
A = [list(input()) for _ in range(h)]
ans = 0
bfs()

print(ans)

### FIXED CODE ###

from subprocess import call
call (('pypy3', '-c', """
from collections import deque

def main():
    h, w = map(int, input().split())
    A = [list(input()) for _ in range(h)]
    d = [[10**9] * w for _ in range(h)]
    que = deque([])
    
    for i in range(h):
        for j in range(w):
           if A[i][j] == "#":
               que.append([i, j])
               d[i][j] = 0
           else:
               d[i][j] = 10 ** 9
            
    while que:
        x, y = que.popleft()
        dx = [1, 0, -1, 0]
        dy = [0, 1, 0, -1]
        for i in range(4): 
            nx = x + dx[i]
            ny = y + dy[i]
            if 0 <= nx < h and 0 <= ny < w and d[nx][ny] == 10**9:
                d[nx][ny] = d[x][y] + 1
                que.append([nx, ny])
    ans = 0
    for i in range(h):
        for j in range(w):
            ans = max(ans, d[i][j])
    print(ans)
    
    return
    
main()

"""))
import math

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

dist_list = [abs(x-y) for x in map(int, input().split())]

if n == 1:
    d = dist_list[0]
else:
    for i in reversed(range(n-1)):
        if i == n-1:
            d = math.gcd(dist_list[i], dist_list[i-1])
        else:
            d = math.gcd(dist_list[i-1], d)    

print(d)

### FIXED CODE ###

# coding:utf-8

from fractions import gcd 

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

dist_list = [abs(x-y) for x in map(int, input().split())]

if n == 1:
    d = dist_list[0]
else:
    d = gcd(dist_list[1], dist_list[0])
    for i in range(n-2):
        d = gcd(d, dist_list[i+1])

print(d)
s=input()
s_list=[]
length=0
for i in s:
    if i=='A' or i=='T' or i=='C' or i=='G':
        length=length+1
    else:
        s_list.append(length)
        length=0
print(max(s_list))


### FIXED CODE ###

s=input()
s_list=[]
length=0
for i in s:
    if i=='A' or i=='T' or i=='C' or i=='G':
        length=length+1
    else:
        s_list.append(length)
        length=0
s_list.append(length)
print(max(s_list))
# M: the number of KOMA
# N: the number of Xs
M, N = map(int, input().split())
# each length of edges
Xs= list(map(int, input().split()))

# searching largest one
largestX = -10**5

# searching smallest one
smallestX = 10**5

# straightforward searching way
for i in range(N):
  if Xs[i] > largestX:
    largestX = Xs[i]
  if Xs[i] < smallestX:
    smallestX = Xs[i]


if M > N:
    print(0)
elif (largestX - smallestX) % M == 0:
    print( int((largestX - smallestX) / M) )
else:
    print( int((largestX - smallestX) / M )+ 1)


### FIXED CODE ###

T, X = map(int, input().split())
print(float(T/X))
a = []
for i in range(10):
    a.append(input())
a = a.sort(reverse=True)
for i in a[0:2]:
    print(i)

### FIXED CODE ###

a = []
for i in range(10):
    a.append(input())
a = sorted(a, key=int, reverse=True)
for i in a[0:3]:
    print(i)
s = str(input())
ans = ""
n = len(s)
for i in range(n)
  if s[i] = "B":
    if ans == "":
      ans = ans + ""
    else:
      ans = ans[:-1]
  else:
    ans = ans + s[i]

### FIXED CODE ###

s = input()
ans = ""
for i in s:
  if i == "B":
    if len(ans) > 0:
      ans = ans[:-1]
  else:
    ans = ans + i
print(ans)
A = imput()
B = imput()
C = imput()

C =- (A - B)
print(C)

### FIXED CODE ###

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

C = C - (A - B)
if C < 0:
    C = 0
print(C)
print(1000-int(input())%1000)%1000

### FIXED CODE ###

n = int(input())
n %= 1000
print(1000 - n if 1000 - n < 1000 else 0)
s = input()

y, m, d = s.split("/")
print("2018/" + m + "/" d)

### FIXED CODE ###

s = input()

y, m, d = s.split("/")
print("2018/" + m + "/" + d)
a,b,c=map(int,input().split())
d=[]
for i in range(a,b+1):
	d.append(i)
#print(d)
e=[]
if c<b:
	for i in range(c):
		e.append(d[i])
		e.append(d[-i-1])
else:
	for i in d:
		print(i)
e.sort()
e=set(e)
for i in e:
	print(i)


### FIXED CODE ###

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

if b-a+1>2*c:
	x=[i for i in range(a,a+c)]
	y=[i for i in range(b-c+1,b+1)]
	e=x+y
else:
	e=[i for i in range(a,b+1)]
#print(e)
for i in e:
	print(i)
N,K=map(int,input().split())
li=[int(input())]
li_sort=sorted(li,reverse=True)
print(sum(li_sort[:K]))

### FIXED CODE ###

N,K=map(int,input().split())
li=list(map(int,input().split()))
li_sort=sorted(li,reverse=True)
print(sum(li_sort[:K]))
S = list(input())

num = 0
num_list = []
for i in S:
    if i == "A" or i == "T" or i == "G" or i == "C":
        num += 1
    else:
        num_list.append(num)
        num = 0
print(max(num_list))

### FIXED CODE ###

S = list(input())

num = 0
num_list = [0]
for i in S:
    if i == "A" or i == "T" or i == "G" or i == "C":
        num += 1
        num_list.append(num)
    else:
        num_list.append(num)
        num = 0
print(max(num_list))
a=int(input())
if a/100==a%100/10 and a/100=a%10:
  print "Yes"
else:
  print "No"

### FIXED CODE ###

s = input()
if s[:1] == s[2:]:
    print('Yes')
else:
    print('No')
x = input().split()

y = map(int, x)

a = y[0]
b = y[1]

c = a*b
d = (a+b)*2

print c, d

### FIXED CODE ###

x = input()

y = x**3

print int(y)
import sys
sys.setrecursionlimit(10 ** 6)  # 再帰関数の再帰の深さを設定
to_index = lambda x: int(x) - 1  # 入力した数字に1を引いたものを返す
print_list_in_2D = lambda x: print(*x, sep="\n")  # リストの要素を改行を挟んで表示する関数

# 入力を整数に変換して受け取る
def input_int(): return int(input())

def map_int_input(): return map(int, input())

MII = map_int_input

def MII_split(): return map(int, input().split())

def MII_to_index(): return map(to_index, input())

def MII_split_to_index(): return map(to_index, input().split())

# 入力全てを整数に変換したものの配列を受け取る
def list_int_inputs(): return list(map(int, input()))

LII = list_int_inputs

def LII_split(): return list(map(int, input().split()))

# 2次元リスト化
def LII_2D(rows_number): return [LII() for _ in range(rows_number)]

def LII_split_2D(rows_number): return [LII_split() for _ in range(rows_number)]

X, Y, A, B, C = MII_split()
p_list = LII_split()
q_list = LII_split()
r_list = LII_split()

prices = p_list + q_list + r_list
prices = prices.sort()
print(sum(prices[0:X + Y]))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 6)  # 再帰関数の再帰の深さを設定
to_index = lambda x: int(x) - 1  # 入力した数字に1を引いたものを返す
print_list_in_2D = lambda x: print(*x, sep="\n")  # リストの要素を改行を挟んで表示する関数

# 入力を整数に変換して受け取る
def input_int(): return int(input())

def map_int_input(): return map(int, input())

MII = map_int_input

def MII_split(): return map(int, input().split())

def MII_to_index(): return map(to_index, input())

def MII_split_to_index(): return map(to_index, input().split())

# 入力全てを整数に変換したものの配列を受け取る
def list_int_inputs(): return list(map(int, input()))

LII = list_int_inputs

def LII_split(): return list(map(int, input().split()))

# 2次元リスト化
def LII_2D(rows_number): return [LII() for _ in range(rows_number)]

def LII_split_2D(rows_number): return [LII_split() for _ in range(rows_number)]

X, Y, A, B, C = MII_split()
p_list = LII_split()
q_list = LII_split()
r_list = LII_split()

prices = sorted(p_list, reverse=True)[0:X] + sorted(q_list, reverse=True)[0:Y] + r_list
prices = sorted(prices, reverse=True)
# print(prices)
print(sum(prices[0:X + Y]))
a, b, x = map(int, input().split())

for n in range(int(x / a), 10**9 + 1):
  if x >= a * n + b * len(str(n)):
    continue;
  else:
    break;
  
print(n - 1)

### FIXED CODE ###

S = input();
day = ["SUN","MON","TUE","WED","THU","FRI","SAT"];

print(7 - day.index(S))