peterverebics/CodeNet_Python_118 huggingface dataset:
a, b, c, d = map(int, input().split())
x = 0
y = 0

if abs(a) >= abs(b):
    x = a
else:
    x = b

if abs(c) >= abs(d):
    y = c
else:
    y = d

if x*y <= 0:
    if abs(a) >= abs(b):
        x = b
    else:
        x = a

    if abs(c) >= abs(d):
        y = d
    else:
        y = c

print(x*y)
a,b,c,d=(int(x) for x in input().split())
p=max(a*c,a*d,b*c,b*d)
# B 
z = list(map(int, input().split(" ")))
maxnum = -1000000000000000000
if z[0]*z[1] < 0 or z[2]*z[3] < 0:
    maxnum = 0
for i in range(2):
    for j in range(2):
        x = z[i]
        y = z[j+2]
    if maxnum < x*y:
        maxnum = x*y
print(maxnum)
a,b,c,d = map(int, input().split())

print(max(a*b, a*c, a*d, b*c, b*d, c*d))
a,b,c,d = map(int, input().split())

list_xy = [a*c,a*d,b*c,b*d]

max_xy = 0

for i in list_xy:
  if i >= max_xy:
    max_xy = i

print(max_xy)
a, b, c, d = map(int, input().split())
print(max(a*c, b*d, a*d))
a, b,c,d = map(int, input().split())
if(b >= 0 and d >= 0):
  print(b*d)
elif(b > 0 and d < 0):
  print(a * c)
elif(b < 0 and d > 0):
  print(b * c)
else:
  print(b * d)
a,b,c,d = (int(x) for x in input().split())
print(b*d)
import sys
input = sys.stdin.readline

a,b,c,d = map(int,input().split())
answer = -10000000001
if a > 0 and c > 0:
    print(b*d)
elif a > 0 and c < 0:
    print(a*d)
elif a < 0 and c < 0:
    print(a*c)
elif a < 0 and c >0:
    print(b*c)
L = list(map(int,input().split()))
a=L[0]
b=L[1]
c=L[2]
d=L[3]

if (a<0 and b>=0 and c<0 and d<0) or (a<0 and b<0 and c<0 and d>=0):
    print(a*c)
elif (a>=0 and b>=0 and c<0 and d<0):
    print(a*d)
elif (c>=0 and d>=0 and a<0 and b<0):
    print(b*c)
else:
    print(b*d)
a, b, c, d = map(int, input().split())
if abs(a) <= abs(b) and abs(c) <= abs(d):
    print(b*d)
elif abs(a) > abs(b) and abs(c) <= abs(d):
    print(b*c)
elif abs(a) <= abs(b) and abs(c) > abs(d):
    print(a*d)
elif abs(a) > abs(b) and abs(c) > abs(d):
    print(a*c)
a,b,c,d = map(int,input().split())
if a >= 0:
  if d <= 0:
    print(a*d)
  else:
    print(b*d)
    
elif b>0:
  if c<0 and d<0:
    print(a*c)
  else:
    print(b*d)
else:
  if c>=0:
    print(b*c)
  else:
    print(a*c)
a,b,c,d,=map(int,input().split())
if(a<-1 and c<-1):
  x=a*c
  print(x)
else:
  y=b*d
  print(y)
a, b, c, d = map(int, input().split())

if b < 0 and d > 0 :
  print(b*c)
elif b > 0 and d < 0 :
  print(a*d)
elif b == d and b == 0 :
  print(a*c)
else :
  print(b*d)
a,b,c,d = map(int,input().split())
answer =0
if b < 0:
	if c < 0:
		answer = a*c
	if c>=0:
		answer = a * c
if b>=0:
	if a <0:
		answer = max(a*c ,b * d,0)
	if a >= 0:
		if d< 0:
			if a == 0:
				answer = 0
			else:
				answer = a*d
		if d>=0:
			answer = b*d
print(answer)
L = list(map(int,input().split()))
a=L[0]
b=L[1]
c=L[2]
d=L[3]

if (a<0 and b>=0 and c<0 and d<0) or (a<0 and b<0 and c<0 and d>=0):
    print(a*c)
elif (a>=0 and b>=0 and c<0 and d<0):
    print(a*d)
elif (c>=0 and d>=0 and a<0 and b<0):
    print(b*c)
elif (a<0 and b>=0 and c<0 and d>=0):
    print(max(a*c,b*d))
else:
    print(b*d)
a,b,c,d=map(int,input().split(" "))
p=max(a*c,b*c,a*c,a*d)
print(p)
a, b, c, d = map(int, input().split())

if b <= 0 and d <= 0:
  print(a*c)
elif b < 0 and c >= 0:
  print(b*c)
elif a >= 0 and d < 0:
  print(a*d)
else:
  print(b*d)
# coding: utf-8
a,b,c,d = map(int,input().split())

print(max(a*b,b*c,c*d,b*c,b*d,c*d))
a, b, c, d = map(int, input().split())

print(max(abs(a), abs(b)) * max(abs(c), abs(d)))
a, b, c, d = map(int, input().split())

if d < 0 and b > 0:
    print(a * d)
elif d > 0 and b < 0:
    print(b * c)
elif a < 0 and c < 0:
    print(a * c)
else:
    print(c * d)
a,b,c,d = map(int,input().split())
if a<0 and c<0 :
  if b>=0 and d>=0:
    if a*c >= b*d:
      print(a*c)
    else:
      print(b*d)
elif a>0 and d<0:
  print(a*d)
elif b<0 and d<0:
  print(a*c)
else:
  print(b*d)
a,b,c,d=map(int,input().split())
ans=[a*b,a*c,a*d,b*c,b*d,c*d]
print(max(ans))
a, b, c, d = map(int, input().split())

ans = max(a*b, a*c, a*d, b*c, b*d, c+d)
  
print(ans)
templist = input().split()
a = int(templist[0])
b = int(templist[1])
c = int(templist[2])
d = int(templist[3])
flg1 = 0
flg2 = 0

if b <= 0:
    flg1 = 1
if d <= 0:
    flg2 = 1
    
if flg1 == 0 and flg2 == 0:
    print(b * d)
elif flg1 == 1 and flg2 == 1:
    if a * c >= b * d:    
        print(a * c)
    else:
        print(b * d)
elif flg1 == 1 and flg2 == 0:
    print(b * c)
else:
    print(a * d)
a, b, c, d = map(int, input().split())
if b<0 and c<0:
    print(a*c)
elif b<0 and d==0:
    print(b*c)
elif b<0 and c>0:
     print(b*c)
elif b==0 and d<0:
    print(a*d)
elif b==0 and d==0:
    print(a*c)
elif b==0 and c>0:
     print(b*c)
elif a>0 and d<0:
    print(a*d)
elif a>0 and d==0:
    print(a*d)
elif a>0 and d>0:
    print(a*d)
a,b,c,d = map(int, input().split())
A = a * b
B = a * c
C = a * d
D = b * c
E = b * d
F = c * d
print(max(A,B,C,D,E,F))
a,b,c,d = map(int,input().split())

ans = 0
if b > 0 and d > 0:
  ans = b*d
elif b <= 0 and d <= 0:
  ans = a*c
elif b >= 0 and d <= 0:
  ans = a*d
elif b <= 0 and d >= 0:
  ans = b*c

print(ans)
a, b, c, d = map(int, input().split())
print(max(a*c, b*d, a*d, b*d))
a, b, c, d = map(int, input().split())

A = a*c
B = a*d
C = b*c
D = b*d


max([A, B, C, D])
# -*- coding: utf-8
a,b,c,d= map(int,input().split())
if a>0 and c>0:
    print(b*d)
if a<0 and c>0 or a>0 and c<0:
    print(a*d)
if a<=0 and c <= 0 :
    print(max(abs(a),abs(b))*max(abs(c),abs(d)))
a,b,c,d=map(int,input().split())
ans = -10**9
for i in [a,b]:
  for j in [c,d]:
    ans = max(ans, i*j)

print(ans)
nums = [int(i) for i in input().split()]
a = nums[0]
b = nums[1]
c = nums[2]
d = nums[3]
ac = a*c
bd = b*d
if (ac<=0 and bd<=0):
  max = a*d
elif (ac>=0 and bd>=0):
  max = max(ac, bd)
elif ac>=0:
  max = ac
elif bd>=0:
  max = bd
  
print(max)
a, b, c, d = map(int, input().split())
ans = 0
if b != 0 and d != 0:
    if c < 0:
        ans = a * d
    else:
        ans = b * d
else:
    ans = min(a, b) * min(c, d)

print(ans)
a,b,c,d = list(map(int, input().split()))
print(max(a*c, b*d))
a, b, c, d = map(int, input().split())

if 0<= a and 1 <= b and 0 <= c and 1 <= d:
    print(b * d)
elif a < 0 and b <= 0 and c < 0:
    print(a * c)
elif b < 0 and 0 <= c and 1 <= d:
    print(b * c)
elif 0 <= a  and d <= 0:
    print(a * d)
a,b,c,d = map(int, input().split())
l = [i*j for i, j in zip(range(a,b+1), range(c,d+1))]
print(max(l))
a,b,c,d = map(int, input().split())



if a >= 0 and c >= 0:
  print(b*d)
elif b <= 0 and d <= 0:
  print(a*c)
elif a < 0 and c < 0:
  if abs(a)>abs(b) and abs(c)>abs(d):
    print(a*c)
  else:
    print(b*d)
elif (b<0 and c>0):
  print(b*c)
elif (a>0 and d<0):
  print(a*d)
else:
  print(b*d)
a,b,c,d = input().split()
print(max(int(a)*int(c),int(b)*int(d)))
# -*- coding: utf-8
a,b,c,d= map(int,input().split())
if  b <= 0 and d <= 0:
    print(max(abs(a), abs(b)) * max(abs(c), abs(d)))
if a  and b and c and d >0:
    print(b*d)
if a<0 and b>0 and c<0 and d>0 :
    print(max(abs(a),abs(b))*max(abs(c),abs(d)))
if b >0 and d<0:
    print(a*d)
a,b,c,d = map(int,input().split())
answer =0
if b < 0:
	if c < 0:
		answer = max(a*c,b*d)
	if c>=0:
		answer = max(a*c,b*d)
if b>=0:
	if a <0:
		answer = max(a*c ,b * d,0)
	if a >= 0:
		if d< 0:
			if a == 0:
				answer = 0
			else:
				answer = a*d
		if d>=0:
			answer = b*d
print(answer)
a, b, c, d = list(map(int, input().split()))

if b > 0 and d > 0:
  print(b * d)
elif a < 0 and c < 0:
  print(a * c)
else:
  print(-1 * min(abs(a), abs(b)) * min(abs(c), abs(d)))
a,b,c,d = map(int,input().split())
A = (a*c)
B = (a*d)  
C = (b*c)
D = (c*d)
MAX = A

if MAX < B:
    MAX = B
elif MAX < C:
    MAX = C
elif MAX < D:
    MAX = D

print(MAX)
a,b,c,d = map(int ,raw_input().split())

print max(a*c, d*b)
def resolve():
    a, b, c, d = map(int, input().split())
    if b <= 0 and d <= 0:
        print(a * c)
    elif a >= 0 and c >= 0:
        print(b * d)
    elif b <= 0 and c >= 0:
        print(b * c)
    elif d <= 0 and a >= 0:
        print(a * d)

resolve()
a,b,c,d=map(int,input().split())
m=a*c
if(a>0 and b>0 and c>0 and d>0):
  m=b*d
elif(a<0 and b<0 and c<0 and d<0):
  m=a*c
elif(a<0 and b<0 and c>0 and d>0):
  m=b*c
elif(a>0 and b>0 and c<0 and d<0):
  m=a*d
elif(a<0 and b>0 and c<0 and d>0):
  max=a*c
print(m)
a,b,c,d = map(int,input().split())
answer =0
if b < 0:
	if c < 0:
		answer = a*c
	if c>=0:
		answer = a * c
if b>=0:
	if a <0:
		answer = max(a*c ,b * d,0)
	if a >= 0:
		if d< 0:
			if a == 0:
				answer = 0
			answer = a*d
		if d>=0:
			answer = b*d
print(answer)
a,b,c,d = map(int,input().split())
if a >= 0:
  if c>=0 or d>=0:
    print(b*d)
  else:
    print(a*d)
elif b<0:
  if d<0:
    print(a*c)
  else:
    if a*c < b*d:
      print(b*d)
    else:
      print(a*c)
a, b, c, d = map(int, input().split())
print(max(a * c, a * d, b + c, b * d))
a,b,c,d = map(int, input().split())

ans1 = a*c
ans2 = b*d

if ans1 > ans2:
    print(ans1)
else:
    print(ans2)
import sys
input = sys.stdin.readline

a,b,c,d = map(int,input().split())
answer = -10000000001
if a >= 0 and c >= 0:
    print(b*d)
elif a >= 0 and c < 0 and d > 0:
    print(b*d)
elif a >= 0 and c < 0 and d < 0:
    print(a*d)
elif a < 0 and c < 0:
    print(a*c)
elif a < 0 and b >= 0 and c >=0:
    print(b*d)
elif a < 0 and b < 0 and c >= 0:
    print(b * c)
#!/usr/bin/env python3

import sys
input=sys.stdin.readline

a,b,c,d=map(int,input().split())
if b<0 and d<0:
    print(a*c)
elif b>=0 and d<0:
    if a<=0:
        print(0)
    else:
        print(a*d)
elif b<0 and d>=0:
    if c<=0:
        print(0)
    else:
        print(b*c)
elif b>=0 and d>=0:
    print(max(b*d,a*c))
import sys
input = sys.stdin.readline

a,b,c,d = map(int,input().split())
answer = -10000000001
if a > 0 and c > 0:
    print(b*d)
elif a > 0 and c < 0:
    print(a*d)
elif a < 0 and c < 0:
    print(a*c)
elif a < 0 and c >0:
    print(b*d)
a,b,c,d = map(int,input().split())
if b>=0 and c>=0:
    print(b*d)
elif b<0 and c>=0:
    print(b*c)
elif a>=0 and c<0 and d>=0:
    print(b*d)
elif a<0 and b>=0 and c<0 and d>=0:
    print(b*d)
elif b<0 and c<0 and d>=0:
    print(b*c)
elif a>=0 and d<0:
    print(a*d)
elif a<0 and b>=0 and d<0:
    print(a*c)
elif b<0 and d<0:
    print(a*c)
a,b,c,d=map(int,input().split())
x,y,r=[],[],[]
for i in range(a,b+1):
    x.append(i)
for i in range(c,d+1):
    y.append(i)
print(x)
print(y)
for i in x:
    for j in y:
        r.append(i*j)
print(max(r))
a, b, c, d = map(int, input().split())

mx = - (1 << 30)

mx = max(a * c, mx)
mx = max(a * d, mx)
mx = max(b * c, mx)
mx = max(b * d, mx)

print(mx)
# B 
z = list(map(int, input().split(" ")))
maxnum = -1000000000
for i in range(2):
    for j in range(2):
        x = z[i]
        y = z[j+2]
        if maxnum < x*y:
            maxnum = x*y
print(maxnum)
def resolve():
    a, b, c, d = list(map(int, input().split()))
    ans = -10 ** 10

    for x in (a, b):
        for y in (c, d):
            ans = max(ans, x * y)

    print(ans)

resolve()
#!/usr/bin/env python3
a,b,c,d=map(int,input().split())
if b>0 and d>0:
    print(b*d)
elif a<0 and c>=0:
    print(b*c)
elif a>=0 and c<0:
    print(a*d)
else:
    print(a*c)
a,b,c,d = map(int,input().split())
if(b<0 and d<0):
  print(a*b)
elif(b<0 or d<0):
  print(0)
else:
  print(b*d)
a,b,c,d = map(int,input().split())
if a*d > b*d:
    print(a*d)
elif a*c > b*d:
    print(a*c)
elif b*c > b*d:
    print(b*c)
elif b*d ==0:
    print(a*c)
else:
    print(b*d)
li = list(map(int,input().split()))

a = li[0]
b = li[1]
c = li[2]
d = li[3]

ac = a * c
bc = b * c
ad = a * d
bd = b * d
result = ac
if result < bc:
    result = bc
elif result < ad:
    result = ad
elif result < bd:
    result = bd
elif a <= 0 and 0 <= b and result < 0:
    result = 0
elif c <= 0 and 0 <= d and result < 0:
    result = 0
print(result)
a,b,c,d = map(int,input().split())
print(max(a*c,b*d))
a,b,c,d=map(int,input().split())
if b>0 and d>0:
    print(b*d)
elif b>0 and d<=0:
    print(a*d)
elif b<=0 and d>0:
    print(b*c)
else:
    print(a*c)
a,b,c,d = list(map(int,input().split()))
if a>0 and c>0:
  print(b*d)
elif a>0 and c<0:
  print(a*d)
elif a<0 and c>0:
  print(b*c)
else:
  print(a*c)
a,b,c,d = map(int, input().split())

print(max(a,b) * max(c,d))
# -*- coding: utf-8 -*-
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

a,b,c,d = map(int, readline().split())
if a >= 0 and c >= 0:
    print(b*d)
elif b <= 0 and d <= 0:
    print(a*c)
else: 
    print(max(a*d,b*d,a*c,b*d))
a,b,c,d= map(int,input().split())
if b>=0 and d>=0:
    print(b*d)
elif b>=0 and d<0 and a>=0:
    print(a*d)
elif b>=0 and d<0 and a<0:
    print(a*c)
elif b<0 and d>=0 and c>=0:
    print(b*c)
elif b<0 and d>=0 and c<0:
    print(a*c)
else:
    print(a*c)
a, b, c, d = map(int, input().split())
ans = 0

if(b > 0 & d > 0):
    ans = b*d
elif(b <= 0 & d <= 0):
    ans = a*c
else:
    ans = a*d
    
print(ans)
a, b, c, d = map(int, input().split())

ans = -2e10
for x in [a, b]:
    for y in [c,d]:
        if x * y > ans:
            ans = x * y
print(ans)
a,b,c,d = map(int,input().split())
if a >= 0 and b >= 0 and c >= 0 and d >= 0:
    print(b*d)
elif a < 0 and b < 0 and c < 0 and d < 0:
    print(a*c)
elif a >= 0 and b >= 0 and c < 0 and d < 0:
    print(a*d)
elif a < 0 and b < 0 and c >= 0 and d >= 0 :
    print(c*d)
elif a < 0 and b >= 0 and c < 0 and d >= 0 :
    if a * c > b * d :
        print(a*c)
    else:
        print(b * d)
a, b, c, d = map(int, input().split())

if (b < 0 and d < 0) or (b > 0 and d > 0):
    print(b * d)
elif b < 0:
    print(b * c)
elif d < 0:
    print(a * c)
li = list(map(int,input().split()))

a = li[0]
b = li[1]
c = li[2]
d = li[3]

ac = a * c
bc = b * c
ad = a * d
bd = b * d
result = ac
if result < bc:
    result = bc
elif result < ad:
    result = ad
elif result < bd:
    result = bd

print(result)
import sys

input_ = sys.stdin.readline

a, b, c, d = [int(x) for x in input_().strip().split(" ")]

x = max(a, b)
y = max(c, d)
if x >= 0 and y >= 0:
    print(x * y)
elif x < 0 and y < 0:
    print(min(a, b) * min(c, d))
elif x < 0:
    print(x * min(c, d))
elif y < 0:
    print(min(a, b) * y)
a, b, c, d = map(int, input().split())
x = a if a >= b else b
y = c if c>= d else d
print(x*y)
def calc(intA,intB,intC,intD):
    #b>0　d>0　→x × y>0 
    if b>0 and d>0:
       ret = b*d
    elif b<=0 and d<=0:
       ret = a*c
    elif b<=0 and d>0:
       ret = b*c
    elif b>0 and d<=0:
       ret = a*d
    return ret

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

print(calc(a,b,c,d))
a, b, c, d = [int(x) for x in input().split()]

max_x = b
max_y = d
min_x = a
min_y = c

li = [max_x, max_y, min_x, min_y]

max_num = -10**9
for i in range(len(li)):
    for j in range(i, len(li)):
        num = li[i] * li [j]
        if num > max_num:
            max_num = num

print(max_num)
array = input().split()

a = float(array[0])
b = float(array[1])
c = float(array[2])
d = float(array[3])

if b > 0 and d > 0:
    print("{:.0f}".format(b*d))
elif b <= 0 and d <= 0:
    print("{:.0f}".format(a*c))
elif b <= 0 and d > 0:
    print("{:.0f}".format(b * c))
elif b > 0 and d <= 0:
    print("{:.0f}".format(a * d))
a,b,c,d=map(int,input().split())
if max(a,b)>0 and max(c,d)>0:
    print(max(a,b)*max(c,d))
elif max(a,b)<0 and max(c,d)<0:
    print(min(a,b)*min(c,d))
elif max(a,b)==0 and max(c,d)==0:
   print(min(a,b)*min(c,d))
elif max(a,b)<=0:
    print(max(a,b)*min(c,d))
else:
    print(min(a,b)*max(c,d))
a, b, c, d = map(int, input().split())
if a > 0 and d < 0:
    print(a * d)
elif b < 0 and c > 0:
    print(b * c)
elif b <= 0 and d <= 0:
    print(a * c)
else:
    print(b * d)
a, b, c, d = map(int, input().split())

print(max(a * c, b * d))
a, b, c, d = map(int, input().split(' '))

print(max(a,b) * max(c,d))
a,b,c,d = map(int, input().split())
if b > 0:
    if d > 0:
        print(b*d)
    else :
        print(a*d)
else :
    if d > 0:
        print(b*c)
    else :
        print(a*c)
a,b,c,d=list(map(int,input().split()))
if b<=0:
    if c<=0:
        print(c*a)
    else:
        print(b*c)
else:
    if d<=0:
        if a<0:
            print(a*c)
        else:
            print(a*d)
    else:
        print(b*d)
n = list(map(int,input().split()))

a =n[0]*n[2]
b =n[0]*n[3]
c =n[1]*n[2]
d =n[0]*n[3]

x = max(a,b,c,d)

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

if(a>= 0 and c>= 0):
    print(b*d)
elif(b<=0 and d<=0):
    print(a*c)
elif(a>=0 and d<=0):
    print(a*d)
elif(b<=0 and c>=0):
    print(b*c)
elif(a*c > b*d):
    print(a*c)
elif(a*c < b*d):
    print(b*d)
a,b,c,d=list(map(int,input().split()))

if a<=b:
  s=b
else:
  s=a
  
if c<=d:
  t=d
else:
  t=c
  
print(s*t)
a,b,c,d = map(int,input().split())
if(b<0 or d<0):
  if(b>0 or d>0):
    print(0)
  else:
    print(a*b)
else:
  print(b*d)
a,b,c,d=input().split()
a=int(a)
b=int(b)
c=int(c)
d=int(d)
if a>0:
  if d>0:
    print(b*d)
  else:
    print(a*d)
else:
  if b>0:
    if d>0:
      print(b*d)
    else:
      print(a*d)
  else:
    print(b*c)
a,b,c,d = list(map(int,input().split()))

x1 = a * c
x2 = a * d
x3 = b * c
x4 = b * d

max = x1
if x2 > max:
    max = x2
elif x3 > max:
    max = x3
else:
    max = x4

print(max)
a, b, c, d = map(int, input().split())
print(b * d)
a,b,c,d=map(int,input().split())
if max(a,b)>0 and max(c,d)>0:
    print(max(a,b)*max(c,d))
elif max(a,b)<0 and max(c,d)<0:
    print(min(a,b)*min(c,d))
elif max(a,b)<=0:
    print(max(a,b)*min(c,d))
else:
    print(min(a,b)*max(c,d))
a,b,c,d = map(int,input().split())

if(a >= 0 and d <= 0):
    print(a*d)
elif(a >= 0 and c >= 0):
    print(b*d)
elif(b <= 0 and d <= 0):
    print(a*c)
elif(b*c < b*d):
    print(b*d)
else:
    print(b*c)
a,b,c,d,=map(int,input().split())
x=a*c
y=a*d
z=b*c
w=b*d
if(w<x and z<x and y<x):
  print(x)
elif(w<y and z<y and x<y):
  print(y)
elif(w<z and x<z and y<z):
  print(z)
elif(y<w and z<w and x<w):
  print(w)
a,b,c,d=map(int,input().split())
l=[]
m=[]

for i in range(a,b+1):
  l.append(i)
for j in range(c,d+1):
  m.append(j)
  
print(int(max(l)*max(m)))
a, b, c, d = map(int, input().split())

if d <= 0 and b > 0:
    print(a * d)
elif d > 0 and b <= 0:
    print(c * b)
elif d <= 0 and b <= 0:
    print(a * c)
else:
    print(b * d)
a, b, c, d = map(int,input().split())

if (a >= 0 and c >= 0):
    print(b * d)
elif (b < 0 and d < 0):
    print(a * c)
elif (a > 0 and d < 0):
    print(a * d)
else:
    print(a * c)
a = list(map(int,input().split()))

for i in range(len(a)) :
    if( a[i] < 0 ):
        a[i] *= -1

a= sorted(a, reverse = True)

print(a[0]*a[1])
a,b,c,d = map(int,input().split())
print(max(a,b)*max(c,d))
a = list(map(int, input().split()))
ans = -float('inf')
for i, v in enumerate(a):
  for j in a[i + 1:]:
    ans = max(ans, v * j)
print(ans)
a,b,c,d = map(int, input().split())

cross_list = [a*c, a*d, b*c, b*d]

cross_list.sort
print(cross_list[3])
a,b,c,d=map(int,input().split())
print(max(a*c,a*d,b*c,b*c))
a = list(map(int,input().split()))

tmp = a[2]
flag = True
flag2 = True
result = []

if a[0] < 10 ** 5 and a[2] < 10 ** 5 and a[1] < 10 ** 5 and a[3] < 10 ** 5:
  print(a[0] * a[2])
  exit(0)

while flag:
  flag2 = True
  if a[0] < a[1]:
    while flag2:
      result.append(a[0] * tmp)
      if tmp == a[3]:
        flag2 = False
        a[0] += 1
        tmp = a[2]
      else:
        tmp += 1
  else:
    flag = False

print(max(result))
a,b,c,d = map(int,input().split())
max = a*c
if a*d > max:
  max = a*d
elif b*c > max:
  max = b*c
elif b*d > max:
  max = b*d

print(max)
a,b,c,d = (int(x) for x in input().split())
if b and d >= 0:
    if a*c > b*d :
        print(a*c)
    else:
        print(b+d)
elif b and d < 0:
    print(a*c)
elif b >=0 and d < 0:
    if a*d > a*c :
        print(a*d)
    else:
        print(a*c)
elif b <0 and d >= 0:
    if a*c > b*c :
        print(a*c)
    else:
        print(b*c)
a,b,c,d = map(int,input().split())
if b<=0:
  if c<0:
    print(a*c)
  elif c>=0:
    print(b*c)
if a >=0:
  if d<=0:
    print(a*d)
  elif d>0:
    print(b*d)
if a<=0 and b>=0:
  if d<=0:
    print(a*c)
  elif c>=0:
    print(b*d)
  else:
    print(max(a*c,b*d))
a,b,c,d = (int(x) for x in input().split())

if a*b==0 or c*d==0:
    print(0)
elif a*b<=0 and c*d<=0:
    if a*c > b*d:
        print(a*c)
    else:
        print(b*d)
    # print("-+-+")
elif b*d>=0:
    # print("b:d>0")
    print(b*d)
elif b<0:
    # print("b<0")
    print(b*c)
else:
    # print("b>0")
    print(a*d)
a, b, c, d = map(int, input().split())
if b >= 0 and d >= 0:
  if abs(a) >= b and abs(c) >= d:
    print(a * c)
  else:
    print(b * d)
elif b < 0 and d < 0:
  print(a * c)
elif b < 0 and d >= 0:
  if c <= 0:
    print(0)
  else:
    print(b * c)
elif b >= 0 and d < 0:
  if a <= 0:
    print(0)
  else:
    print(a * d)
a,b,c,d=input().split()
a=int(a)
b=int(b)
c=int(c)
d=int(d)
if a>0:
  print(b*d)
else:
  if a*c>b*d:
    print(a*c)
  else:
    print(b*d)
a,b,c,d=list(map(int,input().split()))
if (b and d)<0:
  print(a*c)
elif b<0:
  if c<0:
    print(a*c)
  else :
    print(b*c)
elif d<0:
  if a<0:
    print(a*c)
  else :
    print(d*a)
  
else:
  print(d*b)
n,m,k=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

a,b=[0],[0]
for i in range(n):
    a.append(a[i]+A[i])
for i in range(m):
    b.append(b[i]+B[i])
ans,j=0,m
for i in range(n+1):
    if a[i]>k:
        break
    while b[j]>k-a[i]:
        j-=1
    ans=max(ans,i+j)
print(ans)
N,M,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

a,b=[0],[0]
for i in range(N):
    a.append(a[i]+A[i])
for i in range(M):
    b.append(b[i]+B[i])


ans,j=0,M
for i in range(N+1):
    if a[i]>K:
        break
    while b[j]>K-a[i]:
        j-=1
    ans =max(ans,i+j)

print(ans)
n, m, k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a, b = [0], [0]
for i in range(n):
    a += [a[i]+A[i]]
for i in range(m):
    b += [b[i]+B[i]]

ans, i = 0, m
for j in range(n+1):
    if a[j] > k:
        break
    while b[i] > k-a[j]:
        i -= 1
    ans = max(ans, i+j)
print(ans)
n,m,k = map(int, input().split())
a = [int(_) for _ in input().split()]
b = [int(_) for _ in input().split()]

t = sum(b)
j = m
ans = 0
for i in range(n+1):
    while j > 0 and t > k:
        j -= 1
        t -= b[j]
    if t > k: break
    ans = max(ans, i + j)
    if i==n:break
    t+=a[i]

print(ans)
N, M, K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
Asum = [0]
Bsum = [0]
a = 0
b = 0
for i in range(N):
    a += A[i]
    Asum.append(a)
for i in range(M):
    b += B[i]
    Bsum.append(b)
Asum.append(0)
Bsum.append(0)
res, j = 0, M
for i in range(N+1):
    if Asum[i] > K:
        break
    while Asum[i] + Bsum[j] > K:
            j -= 1
    res = max(res,i+j)
print(res)
n,m,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
asum = [0]*(n+1)
bsum = [0]*(m+1)
for i in range(n):
	asum[i+1] = a[i] + asum[i]
for j in range(m): 
	bsum[j+1] = b[j] + bsum[j]
j = m
res = 0
for i in range(n+1):
	if asum[i] > k:
		break
	while asum[i] + bsum[j] > k:
		j-=1
	res = max(res,i+j)
print(res)
import sys
import math 
from collections import deque

n,m,k=map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

a=[0]
b=[0]

for i in range(n):
    a.append(A[i]+a[i])
for i in range(m):
    b.append(B[i]+b[i])

ans,j=0,m

for i in range(n+1):
    if a[i] > k :
        break
    while b[j] > k-a[i] : 
        j-=1
    ans = max(ans, i+j)

print(ans)
n,m,k=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

a,b=[0],[0]
for i in range(n):
    a.append(a[i]+A[i])
for i in range(m):
    b.append(b[i]+B[i])

j,ans=m,0
for i in range(n+1):
    if a[i]>k:
        break
    while b[j] > k-a[i]:
        j-=1
    ans=max(ans,i+j)
print(ans)
N, M, K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

a, b = [0], [0]
for i in range(N):
    a.append(a[i]+A[i])
for i in range(M):
    b.append(b[i]+B[i])

ans, j = 0, M
for i in range(N+1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j -= 1
    ans = max(ans, i+j)

print(ans)