peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
sx,sy,tx,ty = map(int,input().split())
ans = ""
y = ty-sy
x = tx-sx
ans += "U"*y+"R"*x+"D"*y+"L"*(x+1)+"U"*(y+1)+"R"*(x+1)+"DR"+"D"*(y+1)+"L"*(x+1)+"U"
print(ans)
# Judge status: Accepted
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import string
print(string.ascii_lowercase[string.ascii_lowercase.index(input())+1])
# Judge status: Accepted
import itertools
from copy import copy


def lr(abc):
    return


def check(abc, k):
    for i in range(K + 1):
        for v in itertools.combinations_with_replacement([0, 1, 2], i):
            ABC_ = copy(ABC)
            for j in v:
                ABC_[j] *= 2
            if ABC_[0] < ABC_[1] < ABC_[2]:
                return "Yes"
    return "No"


ABC = list(map(int, input().split()))
K = int(input())

print(check(ABC, K))
# Judge status: Accepted
s = input()

start = s.find('A')
stop = s.rfind('Z')
print(stop - start + 1)
# Judge status: Accepted
w,h,x,y=map(int,input().split())
if x==w/2 and y==h/2:
  print(w*h/2, 1)
else:
  print(w*h/2, 0)
# Judge status: Accepted
# 入力
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
BC = [list(map(int, input().split())) for _ in range(Q)]


array = [0]*(10**5+1)
total = sum(A)

for a in A:
    array[a] += 1

for bc in BC:
    b, c = bc
    total += c*array[b]-b*array[b]
    array[c] += array[b]
    array[b] = 0
    print(total)
# Judge status: Accepted
s=input()
if s=="ABC":
    print("ARC")
else:
    print("ABC")
# Judge status: Accepted
s=input()
t=input()
ls=len(s)
lt=len(t)
a=[0]*(ls-lt+1)

for i in range(ls-lt+1):
    for j in range(lt):
        if s[i+j]!=t[j]:
            a[i]+=1

print(min(a))
# Judge status: Accepted
n,d=map(int,input().split())
if n%(d*2+1) == 0:print(int(n/(d*2+1)))
else:print(int(n/(d*2+1)) + 1)
# Judge status: Wrong Answer
s = input()
c= 0
for i in range((len(s)-1)//2):
    if (s[i] != s[(len(s)-1)//2-i-1]) or (s[(len(s)-1)//2+i+1] != s[len(s)-i-1]):
        c = 0
        break
    else:
        c +=1

if c ==(len(s)-1)//2:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
s,t=map(str,input().split())
a,b=map(int,input().split())
u=str(input())
print((a-1),b) if u==s else print(a,(b-1))
# Judge status: Accepted
n, m = map(int, input().split())
if n == m:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N=int(input())
alist=list(map(int,input().split()))

slist=[0]
for a in alist:
  slist.append(slist[-1]+a)  
#print(slist)

answer=float("inf")
for i in range(N+1):
  s1=slist[i]
  s2=slist[-1]-s1
  answer=min(answer,abs(s1-s2))
  
print(answer)
# Judge status: Accepted
n = int(input())
p = list(map(int,input().split()))
  
count = 0
for i in range(n-1):
    if p[i] != i+1:
        count += 1
        if count > 2:
            print("NO")
            exit()
print("YES")
# Judge status: Accepted
A,B,C = map(int, input().split())

if A*B*C%2==0:
    print(0)
    exit()

mylist=[A*B,B*C,A*C]
print(min(mylist))
# Judge status: Accepted
n, k, s = map(int, input().split())
l = [s] * k + [s+1 if s != 10**9 else 1] * (n-k)
print(*l)
# Judge status: Accepted
N = input()

if N.isupper() == True:
    print("A")
else:
    print("a")
# Judge status: Accepted
s = input()
if(s[2] == s[3] and s[4] == s[5]):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
a = input()[:int(input())]
j = set(sorted(set(a), key=a.index)[:2])
j.discard("1")
print(list(j)[0] if j else 1)
# Judge status: Accepted
import sys

s = input()
t = input()

tl = len(t) ; sl = len(s)

if tl > sl :
  print('UNRESTORABLE')
  sys.exit()

for i in range(sl,tl-1,-1) :
  st = s[i-tl:i]
  c = 0
  for j in range(tl) :
    if st[j] == '?' :
      continue
    elif st[j] != '?' and st[j] == t[j] :
      continue
    c = 1
    break
  if c == 0 :
    s = s[:i-tl] + t + s[i:]
    break

if c == 1 :
  print('UNRESTORABLE')
else : 
  print(s.replace('?', 'a'))
# Judge status: Accepted
x = input()

if x in ['7', '5', '3']:
	print('YES') 
else:
	print('NO')
# Judge status: Accepted
N,M = (int(X) for X in input().split())
if N==1 or M==1:
    if N==M:
        print(1)
    else:
        print(max(N,M)-2)
else:
    Four = 4
    Six  = 2*(N+M-4)
    Nine = N*M-(Four+Six)
    print(Nine)
# Judge status: Accepted
n, y = map(int, input().split())
for i in range(n + 1):
  for j in range(n - i + 1):
    if i * 10000 + j * 5000 + (n - i - j) * 1000 == y:
      print(i, j, n - i - j)
      exit()
print("-1 -1 -1")
# Judge status: Accepted
n,k = map(int,input().split())
ans = 0
mod = 10**9+7
for i in range(k,n+2):
    M = n*(n+1)//2-(n-i)*(n-i+1)//2
    m = (i-1)*(i)//2
    ans += M-m+1
    ans %= mod
print(ans)
# Judge status: Accepted
sa=input();sb=input();sc=input()
s=[1,0,0]
ss=[sa,sb,sc]
now = sa[0]

la=len(sa);lb=len(sb);lc=len(sc)
ans=["A","B","C"]
l=[la,lb,lc]
if la<=1:
    print("A")
    exit()

p2n={'a':0,'b':1,'c':2}

while 1:
    nxt=p2n[now]
    if s[nxt]>=l[nxt]:
        print(ans[nxt])
        exit()
    tmp=ss[nxt][s[nxt]]
    s[nxt]+=1
    now=tmp
# Judge status: Accepted
def main():
    N = int(input())
    T, A = map(int, input().split())
    H = [int(x) for x in input().split()]
    rec = 100000000
    ans = 0
    
    for i in range(N):
        C = T - (H[i] * 0.006)
        if C < A:
            C = A - C
        else:
            C = C - A
        if C < 0:
            C = C * (-1)
        if rec > C:
            rec = C
            ans = i + 1
    print(ans)
main()
# Judge status: Accepted
a, b = map(int, input().split())
print(str(a)*b if str(a)*b <= str(b)*a else str(b)*a)
# Judge status: Accepted
S = input()[::-1]

mods = [0]*2019
mods[0] += 1
f = 0
for i in range(len(S)):
    f = (f+pow(10,i,2019)*int(S[i]))%2019
    mods[f] += 1

print(sum([i*(i-1)//2 for i in mods]))
# Judge status: Accepted
n = int(input())
w = [input() for _ in range(n)]

if len(set(w)) != len(w):
    print('No')
else:
    for i in range(n-1):
        if w[i][-1] != w[i+1][0]:
            print('No')
            exit()
    print('Yes')
# Judge status: Wrong Answer
N_ken, M_hon = map(int, input().split())
ab = []
yen = 0
hon = 0

for i in range(N_ken):
    tmp = list(map(int, input().split()))
    ab.append(tmp)

ab.sort()

for a, b in ab:
    tmp = min(M_hon - hon, b)
    yen += tmp * a
    hon += b
    
    
    if (hon == M_hon):
        break

print(yen)
# Judge status: Accepted
S = input()
T = input()

for i in range(len(S)):
    if S[i] != T[i]:
        print('No')
        break
    elif S[i] == T[i] and i == len(S)-1:
        print('Yes')
    else:
        pass
# Judge status: Accepted
import sys
sys.setrecursionlimit(10 ** 9)
def input(): return sys.stdin.readline().rstrip()

def main():
    N = int(input())
    ABC = ("a", "b", "c", "d", "e", "f", "g", "h", "i", "j")

    def dfs(s, n, i):
        if n == N:
            print(s)
            return
        for j in range(i+1):
            dfs(s + ABC[j], n+1, i + 1 if i == j else i)
    dfs("a", 1, 1)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
import itertools

N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))


pos = 0
pos_p = 0
pos_q = 0
for i in itertools.permutations(range(1,4)):
    pos += 1
    print(type(i), i)
    if i == P:
        pos_p = pos
    if i == Q:
        pos_q = pos

print(abs(pos_p - pos_q))
# Judge status: Accepted
def main():
    n = int(input())
    ans = 0
    ans += n // 11 * 2
    if n % 11 <= 6 and n % 11 != 0:
        ans += 1
    elif n % 11 <= 10 and n % 11 > 6:
        ans += 2
    print(ans)
main()
# Judge status: Accepted
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
inf = 10**17
mod = 10**9 + 7

x,a,b=MI()
if b<=a:
    print("delicious")
elif b-a<=x:
    print("safe")
else:
    print("dangerous")
# Judge status: Accepted
X = input()

x = int(X)

gosen = x // 500

goen = (x - 500* gosen) // 5

happy = gosen * 1000 + goen * 5

print(happy)
# Judge status: Accepted
s=input()
t=input()
s=sorted(s)
t=sorted(t,reverse=True)
if s<t:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
n,k = 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])
cnt = 0    
for a,b in l:
    cnt += b
    
    if cnt >= k:
        print(a)
        break
# Judge status: Wrong Answer
N,M = map(int,input().split())
ans=0
ans+=N
M=M-N*2
if(M<0):
	ans = ans - M//2
if(M>0):
	ans = ans + M//4
print(ans)
# Judge status: Accepted
#70 C - 100 to 105 WA
X = int(input())

dp = [0]*(100010)
lst = [100,101,102,103,104,105]
for i in range(100,106):
    dp[i] = 1

# dp[v] が存在するなら 1, しないなら 0
for v in range(100,X+1):
    for w in range(6):
        n = lst[w]
        if dp[v-n] == 1:
            dp[v] = 1
print(dp[X])
# Judge status: Accepted
H, N = map(int, input().split())
A = list(map(int, input().split()))

if sum(A) >= H:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
l, r = map(int, input().split())
#print(l,r)

best = 2019
for i in range(l, min(r,l+2019)):
	for j in range(l+1,min(r+1,l+2019+1)):
		if i*j % 2019 < best:
			best = i*j % 2019

print(best)
# Judge status: Accepted
a, b, c  = map(int, input().split())
abc = len(set([a, b, c]))

if ( abc == 2):
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
n, k = map(int, input().split())
h = list(map(int, input().split()))

h.sort()

print(sum(h[:n-k]))
# Judge status: Accepted
s = input()
first = int(s[:2])
second =int(s[2:])

if (first > 0 and first < 13) and (second > 0 and second < 13):
    print("AMBIGUOUS")
elif (first > 0 and first < 13): 
    print("MMYY")
elif (second > 0 and second < 13):
    print('YYMM')
else:
    print('NA')
# Judge status: Accepted
n,a,b=map(int,input().split())
now=(n-1)*b+a-(n-1)*a-b+1
A=[0,now]
print(max(A))
# Judge status: Accepted
n, m, x = map(int, input().split())
a = []
for i in range(n):
    b = list(map(int, input().split()))
    a.append(b)
l = []
for f in range(2**n):
    p = [0]*(m+1)
    for i in range(n):
        if (bin(f >> i)[-1] == '1'):
            for j in range(m+1):
                p[j] += a[i][j]
    if min(p[1:]) >= x:
        l.append(p[0])
if len(l) == 0:
    print('-1')
else:
    print(min(l))
# Judge status: Accepted
n, k = map(int, input().split())
S = set()
D = dict()
for _ in range(n):
    a, b = map(int, input().split())
    if a in S:
        D[a] += b
    else:
        S.add(a)
        D[a] = b
L = sorted(S)
cnt = 0
for l in L:
    cnt += D[l]
    if cnt >= k:
        print(l)
        break
# Judge status: Accepted
import collections
n = int(input())

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

b = collections.Counter(a)

ans = 0

for k,v in b.items():
    if v < k:
        ans += v
    else:
        ans += (v-k)

print(ans)
# Judge status: Accepted
s = input()
s = sorted(s)
flg = 1
for i in range(len(s) - 1):
	if s[i] == s[i + 1]:flg = 0
if flg:print("yes")
else:print("no")
# Judge status: Wrong Answer
n = int(input())
li = list(map(int,input().split()))

if len(list(set(li))) == 1:
    print(li[0])
else:
    flag = False
    for l in li:
        if l%2 == 1:
            flag = True
    if flag:
        print(1)
    else:
        print(2)
# Judge status: Wrong Answer
l = list(input())
for i in range(8):
  s = int(l[0])
  b = bin(i)[2:].zfill(3)
  op = ["", "", ""]
  for j in range(len(b)):
    if b[j] == "0":
      s += int(l[j+1])
      op[j] = "+"
    else:
      s -= int(l[j+1])
      op[j] = "-"
  if s == 7:
    print(l[0]+op[0]+l[1]+op[1]+l[2]+op[2]+l[3]+"=7")
# Judge status: Wrong Answer
N,M,X,Y=map(int,input().split())
L1=list(map(int,input().split()))
L2=list(map(int,input().split()))
if max(L1)>min(L2):
    print("War")
elif max(L1)<=Y and X<=min(L2):
    print("No War")
else:print("War")
# Judge status: Accepted
a,b,k=map(int,input().split())
p=[]
for i in range(1,a+1):
  if a%i==0 and b%i==0:
    p.append(i)

n=len(p)
print(p[n-k])
# Judge status: Accepted
import math
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = min(a,b,c,d,e)
print(math.ceil(n/f)+4)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ans = 0
for i, v in enumerate(b):
    for j in range(2):
        m =  min(a[i+j], v)
        a [i+j] -= m
        v -= m
        ans += m
print(ans)
# Judge status: Wrong Answer
N = int(input())
S = input()
codePoint = []

splitedInput = list(S)
wordCount = len(splitedInput)
for i in range(wordCount):
    convertAscii = ord(splitedInput[i]) + N
    if convertAscii > ord("Z"):
        convertAscii = convertAscii - ord("Z") + ord("A") - 1
    conversion = chr(convertAscii)
    codePoint.append(conversion)

print(codePoint)
# Judge status: Accepted
n=int(input());print(1000-n%1000 if n%1000!=0 else 0)
# Judge status: Accepted
#import numpy as np
#import collections
#import math

#f = open('./input_B.txt')
#
#list(map(int, f.readline().split()))
#map(int, f.readline().split())
#int(f.readline())
#f.readline()


ans = 0
#list(map(int, input().split()))
N,D = map(int, input().split())
D2 = D**2
for i in range(N):
    X,Y = map(int, input().split())
    if X**2 + Y**2 <= D2:
        ans+=1
#int(input())
#input()


print(ans)
# Judge status: Wrong Answer
S = list(input())
S = sorted(list(set(S)))
i = 97
for s in S:
    if ord(s) != i:
        print(chr(i))
        exit()
    i += 1
print('None')
# Judge status: Accepted
#!/usr/bin/env python3

def main():
    from collections import Counter

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

    ans = [None] * Q
    Asum = sum(A)
    A_Counter = Counter(A)
    for q in range(Q):
        B, C = map(int, input().split())
        Asum = Asum + (C-B)*A_Counter[B]
        A_Counter[C] += A_Counter[B]
        A_Counter[B] = 0

        ans[q] = Asum

    print('\n'.join(map(str, ans)))


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
import math
X, Y = [int(x) for x in input().split()]
a = math.log2(Y/X)
i = 0
while i <= a:
    i += 1
print(i)
# Judge status: Wrong Answer
comp=753
s=input()
ans=0
for i in range(7,0,-1):
  if s.count(str(i)):
    left = s.find(str(i))
    while left!=-1 and left<=len(s)-3:
      ans = max(ans,int(s[left:left+3]))
      left = s.find(str(i),left+1)
    break
print(abs(comp-ans))
# Judge status: Accepted
S = input()
cnt = [S.count(x) for x in 'abc']
if max(cnt)-min(cnt) < 2:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
A, B = map(int, input().split())

price = 0
if A >= 13: 
    B 
elif A >= 6 and A <= 12: 
    B/2 
else:
     0
# Judge status: Accepted
#設定
import sys
input = sys.stdin.buffer.readline

#ライブラリインポート
from collections import defaultdict

con = 10 ** 9 + 7
#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N, A, B = getlist()
	ans = int(N // (A + B)) * A + min(N % (A + B), A)
	print(ans)


if __name__ == '__main__':
	main()
# Judge status: Accepted
S,T=input().split()
A,B=map(int,input().split())
U=input()

if S==U:
  print(str(A-1) + " " + str(B))
else:
  print(str(A) + " " + str(B-1))
# Judge status: Wrong Answer
t = input()

list_t = list(t)

for i in range(len(list_t)):
    if list_t[i] == '?':
        if i > 0:
            if list_t[i - 1] == 'P':
                list_t[i] = 'D'
            else:
                list_t[i] = 'D'
        if i < len(list_t) - 1:
            if list_t[i + 1] == 'D':
                list_t[i] = 'P'

print(''.join(list_t))
# Judge status: Wrong Answer
#--------------------------------------------
#ライブラリ呼び出し
import sys
import math
#--------------------------------------------
D, N = map(int, input().split())

if D ==100:
    D=101
a=100**D
print(a*N)
# Judge status: Accepted
n,k=map(int,input().split())
p=list(map(int,input().split()))
p.sort()
print(sum(p[:k]))
# Judge status: Accepted
a,b,m=map(int,input().split())
alis=list(map(int,input().split()))
blis=list(map(int,input().split()))
ans=10**18
d=dict()
for i in range(m):
  x,y,c=map(int,input().split())
  x-=1
  y-=1
  d[(x,y)]=c
  ans=min(ans,alis[x]+blis[y]-c)
alis1=[]
blis1=[]
for i in range(a):
  alis1.append((alis[i],i))
for i in range(b):
  blis1.append((blis[i],i))
alis1.sort()
blis1.sort()
if (alis1[0][1],blis1[0][1]) not in d:
  ans=min(ans,alis1[0][0]+blis1[0][0])
print(ans)
# Judge status: Accepted
S = input()
flag = False

for i in range(len(S) - 1):
  if S[i] == S[i + 1]:
    flag = True
    break

if flag == False:
  print("Good")
else:
  print("Bad")
# Judge status: Wrong Answer
n = list(map(int, input().split()))
p = list(map(int, input().split()))
lists = list()
x = n[0] - n[1] + 1

for i in range(x):
  lists.append(sum(p[i:i+n[1]]))
  
print ((n[1] + max(lists) /2))
# Judge status: Accepted
x, y, z = input().split()
print(z + ' ' + x + ' ' + y)
# Judge status: Wrong Answer
a, b, c, x, y = map(int, input().split())

ans = 5000*10**5
for i in range(max(x, y)+1):
    tmp_ans = i*2*c
    if (x-i)*a > 0:
        tmp_ans += (x-i)*a
    if (y-i)*b > 0:
        tmp_ans += (y-i)*b
    ans = min(ans, tmp_ans)

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

if a == 0:
    print("1")
elif b == 0:
    print("2")
elif c == 0:
    print("3")
elif d == 0:
    print("4")
elif e == 0:
    print("5")
# Judge status: Accepted
N = int(input())

cnt = 0
for i in range(1, N+1):
    if i % 3 == 0 or i % 5 == 0:
        continue
    else:
        cnt += i

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

def maxf(n):
    a = list(map(int, list(n)))
    for i, item in enumerate(a):
        if i == 0 and item != 9:
            a[i] -=1
            a[i+1:] = [9]*(len(a)-1)
            break
        elif item != 9:
            a[i-1] -= 1
            a[i:] = [9]*(len(a)-i)
            break
    return sum(a)

print(maxf(n))
# Judge status: Accepted
k,n = map(int,input().split())
a = list(map(int,input().split()))
if a[0] == 0:
	dis = [k - a[n-1]]
else:
	dis = [k - a[n-1] + a[0]]
for i in range(n-1):
	dis.append(a[i+1] - a[i])
print(k - max(dis))
# Judge status: Accepted
s = list(set(list(map(int, input().split()))))
print(len(s))
# Judge status: Wrong Answer
int1,int2 = map(int, input().split())

mp = int1*int2

if mp%2 == 0:
    print("even")
elif mp%2 == 1:
    print("odd")
# Judge status: Wrong Answer
if __name__ == '__main__':
    k = input()
    k = int(k)
    ab = input()
    ab = ab.split()
    a = int(ab[0])
    b = int(ab[1])

    i = 1
    flag = False
    while k<b:
        k = k*i
        if a<=k and k<=b:
            flag = True
        i += 1
    if flag:
        print("OK")
    else:
        print("NG")
# Judge status: Accepted
import sys
import bisect
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(readline())

mod = 10**9+7

ans = 1
for i in range(1,n+1):
    ans *= i
    ans %= mod

print(ans)
# Judge status: Accepted
N,K = map(int,input().split())
H = list(map(int,input().split()))

if N <= K:
    print(0)
else:
    H.sort()
    if K == 0:
        print(sum(H))
    else:
        print(sum(H[:-K]))
# Judge status: Accepted
a = list(map(int, input().split()))
a.sort()

print(int(a[0]*a[1]*(a[2] - a[2]//2 -a[2]//2)))
# Judge status: Accepted
s = str(input())
#print(s[0])

ans = s.count('1') #各要素の個数をカウント
print(ans)
# Judge status: Accepted
import sys
import fractions


def input():
    return sys.stdin.readline()[:-1]


N = int(input())
ans = 0
for _ in range(N):
    if ans == 0:
        ans = int(input())
    else:
        t = int(input())
        ans = (ans * t) // fractions.gcd(ans, t)
print(ans)
# Judge status: Accepted
X, Y = map(int, input().split())
i = 1

if X%Y==0:
    print(-1)
    exit()
    
while X<=10**18:
    if X*i%Y != 0:
        print(X*i)
        exit()
    else:
        i += 1

print(-1)
# Judge status: Accepted
a, b = map(int, input().split())
ans = -1

if a >= 10 or b >= 10:
    print(ans)
else:
    ans = a*b
    print(ans)
# Judge status: Accepted
n,k=map(int,input().split())
s=input()
S=s[0:k-1]+s[k-1].lower()+s[k:]
print(S)
# Judge status: Wrong Answer
N=int(input())
pre_t=0
pre_x=0
pre_y=0
flg=0
for i in range(N-1):
    t,x,y=map(int,input().split())
    t_tmp = t
    t=t-pre_t
    dist=abs(x-pre_x) + abs(y - pre_y)
    pre_t=t_tmp
    pre_x=x
    pre_y=y
    if(dist >= t ):
        flg=1
        break
    if((dist)%2 != t%2):
        flg=1
        break
if(flg == 0):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import statistics

n = int(input())
aa = [None] * n
bb = [None] * n
for i in range(n):
    a, b = map(int, input().split())
    aa[i] = a
    bb[i] = b

def median(arr):
    if len(arr) % 2 == 0:
        return (arr[n // 2 - 1] + arr[n // 2]) / 2
    else:
        return arr[n // 2]

m = n
if n % 2 == 0:
    m *= 2
medmin = median(sorted(map(lambda x: x * m, aa)))
medmax = median(sorted(map(lambda x: x * m, bb)))

print(int((medmax - medmin) / n) + 1)
# Judge status: Accepted
kami = set()
N = int(input())
for x in range(N):
  i = int(input())
  if i in kami:
    kami.remove(i)
  else:
    kami.add(i)
print(len(kami))
# Judge status: Accepted
n = int(input())
a = [int(input()) for i in range(n)]
ans = 0
ans += a[0]//2
a[0] %= 2
for i in range(1,n):
    if a[i-1] == 1 and a[i] > 0:
        ans += 1
        a[i] -= 1
    ans += a[i]//2
    a[i] %= 2
print(ans)
# Judge status: Wrong Answer
n,x,t = map(int,input().split())
print(round(n/x+0.5)*t)
# Judge status: Accepted
from math import gcd

from math import factorial as f

from math import ceil, floor, sqrt
import math

import bisect
import re
import heapq

from copy import deepcopy
import itertools
from itertools import permutations

from sys import exit

ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(map(int, input().split()))

yes = "Yes"
no = "No"


def main():
    a,b,c,d = mi()
    ans = -100000000000000000000
    ans = max(a*c,ans)
    ans = max(b*c,ans)
    ans = max(a*d,ans)
    ans = max(b*d,ans)
    print(ans)




main()
# Judge status: Accepted
n=int(input())
print("ABC" if n < 1000 else "ABD")
# Judge status: Accepted
import math

N = [int(x) for x in input()]
if(sum(N)%9==0):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
x,y=map(int,input().split())
ans=[x]
tmp=x
while tmp<y:
    if tmp*2<=y:
        ans.append(tmp)
        tmp=tmp*2
    else:
        break
print(len(ans))
# Judge status: Accepted
n = int(input())
s = input()
if n % 2 == 1:
    print("No")
else:
    n //= 2
    if s == s[:n]*2:
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
K,S=map(int,input().split())

count=0

for x in range(K+1):
    for y in range(x+1):
        z=S-x-y
        if z<0 or z>y:
            pass
        else:
            #print(x,y,z)
            if x==y==z:
                count+=1
            elif x==y or x==z or y==z:
                count+=3
            else:
                count+=6
        
print(count)
# Judge status: Accepted
from sys import stdin
n = int(stdin.readline())
a = list(map(int,stdin.readline().split()))
a.sort(reverse = True)
ans = a[0]
count = 0
cur = 1
for _ in range(n-2):
    ans += a[cur]
    count += 1
    if count == 2:
        count = 0
        cur += 1
print(ans)
# Judge status: Accepted
n = int(input())
print(n * (n-1) // 2)
# Judge status: Accepted
def mod_inv(a, m):
    return pow(a, m-2, m)


X, Y = map(int, input().split())
MOD = 10 ** 9 + 7

if (X + Y) % 3:
    print(0)
    exit()

n = (X + Y) // 3
nx, ny = X - n, Y - n

if nx < 0 or ny < 0:
    print(0)
    exit()

ans = 1
for i in range(nx + 1, nx + ny + 1):
    ans = ans * i % MOD
for i in range(1, ny + 1):
    ans = ans * mod_inv(i, MOD) % MOD

print(ans)