Problem:
 Score : 200 points    Problem Statement Given are integers a,b,c and d .
If x and y are integers and a \leq x \leq b and c\leq y \leq d hold, what is the maximum possible value of x \times y ?      Constraints  -10^9 \leq a \leq b \leq 10^9  -10^9 \leq c \leq d \leq 10^9  All values in input are integers.         Input Input is given from Standard Input in the following format:  a  b  c  d       Output Print the answer.        Sample Input 1 1 2 1 1      Sample Output 1 2  If x = 1 and y = 1 then x \times y = 1 .
If x = 2 and y = 1 then x \times y = 2 .
Therefore, the answer is 2 .       Sample Input 2 3 5 -4 -2      Sample Output 2 -6  The answer can be negative.       Sample Input 3 -1000000000 0 -1000000000 0      Sample Output 3 1000000000000000000

Solution (Python):


from queue import Queue
from queue import LifoQueue as Stack
from math import sqrt, floor, ceil, log2, log10, pi
from fractions import gcd
from itertools import permutations, combinations
from operator import itemgetter
from functools import cmp_to_key
from bisect import bisect_left


INF=1001001001
__MOD__=(10**9)+7
yn = 'YNeos'
judge = False
cnt = 0
ans = None


def lcm(a, b):
    return (a*b) // gcd(a,b)

def intinput():
    return int(input())

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

def lineinputs(func=intinput):
    datas = []
    while True:
        try:
            datas.append(func())
        except EOFError:
            break
    return datas

def bindex(a,x):
    i = bisect_left(a,x)
    if i != len(a) and a[i] == x:
        return i
    return None

class ModInt():
    def __init__(self, x):
        self.__x = (x % __MOD__)
    def __add__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x + other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x + other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __radd__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((other.__x + self.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((other.__x + self.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")

    def __sub__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x - other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x - other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __rsub__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((other.__x - self.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((other.__x - self.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")

    def __mul__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x * other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x * other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __rmul__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((other.__x * self.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((other.__x * self.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")

    def __truediv__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x * other.__modinv())%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x * other.__modinv())%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __rtruediv__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((other.__x * self.__modinv())%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((other.__x * self.__modinv())%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")

    def __pow__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__(pow(self.__x, other.__x, __MOD__)))
        elif type(other) == ModInt:
            return self.__class__(pow(self.__x, other.__x, __MOD__))
        else:
            raise Exception("Not Int or Not ModInt")
    def __rpow__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__(pow(other.__x, self.__x, __MOD__)))
        elif type(other) == ModInt:
            return self.__class__(pow(other.__x, self.__x, __MOD__))
        else:
            raise Exception("Not Int or Not ModInt")

    def __modinv(self, m=__MOD__):
        a = self.__x
        if a == 0:
            raise ZeroDivisionError()
        if gcd(a, m) != 1:
            raise Exception("%sの逆数は求まりません。" % a)
        b, u, v = m, 1, 0
        while b != 0:
            t = a//b;
            a -= t*b
            a, b = b, a
            u -= t * v
            u, v = v, u
        u %= m
        if u < 0:
            u += m
        return u
    def __int__(self):
        return self.__x
    def __str__(self):
        return str(self.__x)



if __name__ == '__main__':
    a, b, c, d= mulinputs()

    t = -1*((10**18)+1)
    for x in (a,b):
        for y in (c, d):
            t = max(t, x*y)
    if t == -1*((10**18)+1):
        print(max(a,b)*max(c,d))
    print(t)

Solution (Python):
a, b, c, d = map(int, input().lower().split())

n1 = a*c
n2 = b*c
n3 = a*d
n4 = b*d

print(max(n1,n2,n3,n4))

Solution (Python):
x = input()
a = int(x.split()[0])
b = int(x.split()[1])
c = int(x.split()[2])
d = int(x.split()[3])




bd = b*d
ac = a*c
ad = a*d
bc = b*c

max = bd

if max < ac:
 max = ac
if max < ad:
 max = ad
if max < bc:
 max = bc

print(max)

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

if a >= 0 and c >= 0:
    ans = b * d
elif b <= 0 and d <= 0:
    ans = a * c
else:
    ans = max(a * c, a * d, b * c, b * d)

print(ans)

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



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

print(max(x1,x2,x3,x4))

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

ri1 = [a,b]
ri2 = [c,d]
ma = -10**20

for i in range(2):
    for j in range(2):
        a = ri1[i]*ri2[j]
        if a > ma:
            ma = a
print(ma)

Solution (Python):
A,B,C,D = map(int, input().split())

a1 = A * C
a2 = A * D
a3 = B * C
a4 = B * D

list = (a1,a2,a3,a4)

print(max(list))

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

print(max(a*c,a*d,b*c,b*d))

Solution (Python):
a, b, c, d = [int(x) for x in input().split()]
ans = [a*c, a*d, b*c, b*d]
print(max(ans))

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

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

print(maxxy)

Solution (Python):
a,b,c,d=map(int,input().split())
ac=a*c
ad=a*d
bc=b*c
bd=b*d
list=[ac,ad,bc,bd]
list.sort()
print(list[3])

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

Solution (Python):
def main():
    
    a, b, c, d = map(int, input().split())
    ans = max(a * c, a * d, b * c, b * d)
    print(ans)

if __name__ == "__main__":
    main()

Solution (Python):
t = input()
t = t.split(" ")
t = [int(x) for x in t]

a,b = t[0], t[1]
c,d = t[2], t[3]

print(max(a*c,a*d, b*c,b*d))

Solution (Python):
from sys import stdin
readline = stdin.readline

def i_input(): return int(readline().rstrip())
def i_map(): return map(int, readline().rstrip().split())
def i_list(): return list(i_map())

def main():
    A, B, C, D = i_map()
    if B <= 0 and D <= 0:
        ans = A * C
    elif B < 0 and C < 0:
        ans = A * C
    elif A < 0 and D < 0:
        ans = A * C
    elif B <= 0 and C >= 0:
        ans = B * C
    elif D <= 0 and A >= 0:
        ans = A * D
    elif A * C > B * D:
        ans = A * C
    else:
        ans = B * D
    print(ans)

if __name__ == "__main__":
    main()

Solution (Python):
a,b,c,d = map(int,input().split())
ans1=a*c
ans2=a*d
ans3=b*c
ans4=b*d
print(max(ans1,ans2,ans3,ans4))

Solution (Python):

import sys
import numpy as np


def solve(a: int, b: int, c: int, d: int):
    ans = max([a*c, a*d, b*c, b*d])
    print(ans)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    a = int(next(tokens))  
    b = int(next(tokens))  
    c = int(next(tokens))  
    d = int(next(tokens))  
    solve(a, b, c, d)

if __name__ == '__main__':
    main()

Solution (Python):
n = list(map(int, input().split()))
li = []
for i in range(0, 2):
  for s in range(2, 4):
    li.append(n[i] * n[s])
print(max(li))

Solution (Python):
a,b,c,d=map(int,input().split())
"""
if b<=0 and d<=0:
    print(a*c)
elif b<=0 and d>=0:
    print(a*d)
elif b>=0 and d<=0:
"""
A=abs(a)
B=abs(b)
C=abs(c)
D=abs(d)

check_1 = a*c
check_2=a*d
check_3=b*c
check_4=b*d

if check_1<=check_2:
    check_1=check_2

if check_3<=check_4:
    check_3=check_4

if check_1<=check_3:
    print(check_3)
else:
    print(check_1)

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

Solution (Python):
[x1, x2, y1 ,y2] = [int(i) for i in input().split()]
max = x1 * y1
x = [x1, x2]
y = [y1, y2]
for num_x in x:
    for num_y in y:
        re = num_x * num_y
        if re >= max:
            max = re
print(max)

Solution (Python):
a,b,c,d = map(int,input().split())
ans = []

ans.append(a*c)
ans.append(b*c)
ans.append(b*d)
ans.append(a*d)

print(max(ans))

Solution (Python):
a, b, c ,d = map(int, input().split())
X = []
X.append(a * c)
X.append(a * d)
X.append(b * c)
X.append(b * d)
print(max(X))

Solution (Python):
inputstr = input()
inputlist = inputstr.split()
a = int(inputlist[0])
b = int(inputlist[1])
c = int(inputlist[2])
d = int(inputlist[3])

ac = a*c
ad = a*d
bc = b*c
bd = b*d

max = -9999999999999999999999999
if max < ac:
    max = ac
if max < ad:
    max = ad
if max < bc:
    max = bc
if max < bd:
    max = bd

print(max)

Solution (Python):
import sys

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

a,b,c,d = LI()
























if a==b==c==d==0:
    print(0)
elif 0<=a and 0<=c:
    print(b*d)
elif b<=0 and d<=0:
    print(a*c)
elif a<0<b:
    if 0<=c:
        print(b*d)
    elif c<0<d:
        print(max(a*c,b*d))
    elif d<=0:
        print(a*c)
elif c<0<d:
    if 0<=a:
        print(b*d)
    elif a<0<b:
        print(max(a*c,b*d))
    elif b<=0:
        print(a*c)
elif 0<=a and d<=0:
    print(a*d)
elif 0<=c and b<=0:
    print(b*c)

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

if(a>=0 and b>=0 and c>=0 and d>=0) or (a>=0 and b>=0 and c<0 and d>=0) or (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) or (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(a<0 and b<0 and c>=0 and d>=0):
    print(b*c)
else:
    print(max(a*c,b*d))

Solution (Python):
import sys
import re
import queue
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext

def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
	a,b,c,d = i_map()
	max_xy = max([a*c,b*c,a*d,b*d])

	print(max_xy)

	return


if __name__ == '__main__':
	main()

Solution (Python):
nums = list(map(int, input().split()))

max_num = max(nums[0] * nums[2], nums[1] * nums[3], nums[0] * nums[3], nums[1] * nums[2])
print(max_num)

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

if a>=0:
    if c>=0:
        print(b*d)
    elif c<0 and d>=0:
        print(b*d)
    elif d<0:
        print(a*d)

elif a<0 and b>=0:
    if c>=0:
        print(b*d)
    elif c<0 and d>=0:
        print(max(a*c,b*d))
    elif d<0:
        print(a*c)

elif b<0:
    if c>=0:
        print(b*c)
    elif c<0 and d>=0:
        print(a*c)
    elif d<0:
        print(a*c)

Solution (Python):
a,b,c,d=map(int,input().split())
l=[]
l.append(a*c)
l.append(a*d)
l.append(b*c)
l.append(b*d)
M=max(l)
print(M)

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

ma = a*c
if  ma < a*c:
    ma = a*c
if ma < a*d:
    ma = a*d
if ma < b*c:
    ma = b*c
if ma < b*d:
    ma = b*d
print(ma)

Solution (Python):
a,b,c,d = map(int,input().split())
score=[]
score+=a*c,b*c,a*d,b*d
print(max(score))

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

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


if(b*d>=a*c and b*d>=b*c and b*d>=a*d):
    print(b*d)
elif(a*c>=b*d and a*c>=a*d and a*c>=b*c):
    print(a*c)
elif(a*d>=a*c and a*d>=b*c and a*d>=b*d):
    print(a*d)
elif(b*c>=a*c and b*c>=b*d and b*c>=a*d):
    print(b*c)

Solution (Python):
data = list (int(i) for i in input().split())
res = []
d_i = [0, 1]
d_j = [2, 3]
for i in d_i:
    for j in d_j:
        res.append(data[i] * data[j])

res_num = max(res)
print(res_num)

Solution (Python):
l = input().split()
a = int(l[0])
b = int(l[1])
c = int(l[2])
d = int(l[3])
r = []
r.append(a*c)
r.append(a*d)
r.append(b*c)
r.append(b*d)
print(max(r))

Solution (Python):
a,b,c,d = map(int,input().split())
List = set([])
List.add(a*c)
List.add(a*d)
List.add(b*c)
List.add(b*d)
print(max(List))

Solution (Python):
a, b, c, d = map(int, input().split())
ans=[a*c, a*d, b*c, b*d]
print(max(ans))

Solution (Python):
S = input().split()
a, b, c, d = int(S[0]), int(S[1]), int(S[2]), int(S[3]), 
l = [a*c, a*d, b*c, b*d]
print(max(l))

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

ans1 = a*c
ans2 = b*d
ans3 = a*d
ans4 = b*c

    
if d<0 and a>0:
    print(ans3)
elif c>0 and b<0:
    print(ans4)    
else:
    if ans1 > ans2:
        print(ans1)
    else:
        print(ans2)

Solution (Python):
def main():
    a, b, c, d = map(int, input().split())

    ans = max(a * c, a * d, b * c, b * d)
    print(ans)


main()

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

e=a*c
f=a*d
g=b*c
h=b*d

print(max(max(e,f),max(g,h)))

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

Solution (Python):
a,b,c,d = map(int,input().split())
List = set([])
List.add(a*c)
List.add(a*d)
List.add(b*c)
List.add(b*d)
print(max(List))

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

print(max(a*c,a*d,b*c,b*d))

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

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

ans = -(10**19)

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

Solution (Python):
def main():
    a, b, c, d = map(int, input().split())
    if b * d > 0 or a * c > 0:
        x = max(b * d, a * c)
    else:
        x = max(a * d, b * c)
    print(x)
    return

if __name__ == '__main__':
    main()

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

print(max(a*c,a*d,b*c,b*d))

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

print(max(a*c, a*d, b*c, b*d))

Solution (Python):
from sys import stdin
rs = lambda : stdin.readline().strip()
ri = lambda : int(rs())
ril = lambda : list(map(int, rs().split()))

def main():
    a, b, c, d = ril()
    x = [a, b]
    y = [c, d]
    if a <= 0 and 0 <= b:
        x.append(0)
    if c <= 0 and 0 <= d:
        y.append(0)
    ans = max([i * j for i in x for j in y])
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
input_lines = input().split()
num_lines = []
a = int(input_lines[0])
b = int(input_lines[1])
c = int(input_lines[2])
d = int(input_lines[3])

num_lines.append(a*c)
num_lines.append(a*d)
num_lines.append(b*c)
num_lines.append(b*d)

print(max(num_lines))

Solution (Python):
a, b, c, d = [int(x) for x in input().split()]
print(max(a*c, a*d, b*c, b*d))

Solution (Python):
if __name__ == "__main__":
  li = list(map(int, input().split()))
  array = []
  array.append(li[0] * li[2])
  array.append(li[0] * li[3])
  array.append(li[1] * li[2])
  array.append(li[1] * li[3])
  
  print(max(array))

Solution (Python):
a, b, c, d = list(map(int, open(0).read().split()))
print(max([a*c, a*d, b*c, b*d]))

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

if a >= 0:
    if c >= 0:
        print(b * d)
    elif d < 0:
        print(a * d)
    else:
        print(b * d)
else:
    if b < 0:
        if c >= 0:
            print(b * c)
        elif d < 0:
            print(a * c)
        else:
            print(a * c)
    else:
        if c >= 0:
            print(b * d)
        elif d < 0:
            print(a * c)
        else:
            print(max([a*c, b*d]))

Solution (Python):
import sys
import math
from collections import defaultdict, deque, Counter
from copy import deepcopy
from bisect import bisect, bisect_right, bisect_left
from heapq import heapify, heappop, heappush
    
input = sys.stdin.readline
def RD(): return input().rstrip()
def F(): return float(input().rstrip())
def I(): return int(input().rstrip())
def MI(): return map(int, input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def LF(): return list(map(float,input().split()))
def Init(H, W, num): return [[num for i in range(W)] for j in range(H)]
    
    
def main():
    a,b,c,d = MI()
    ans = max(a*c, a*d, b*c, b*d)
    print(ans)
if __name__ == "__main__":
    main()

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

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

Solution (Python):
def main():
    a, b, c, d = map(int, input().split())

    ans = float('inf') * -1
    for i in [a, b]:
        for j in [c, d]:
            ans = max(ans, i * j)

    if (a < 0 and 0 < b):
        ans = max(ans, 0)
    if (c < 0 and 0 < d):
        ans = max(ans, 0)
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
import sys

def solve():
    A, B, C, D = [int(i) for i in input().split()]
    ans = sys.maxsize * -1
    X = [0, A, B] if A <= 0 <= B else [A, B]
    Y = [0, C, D] if A <= 0 <= B else [C, D]
    for x in X:
        for y in Y:
            ans = max(ans, x * y)
    print(ans)

if __name__ == "__main__":
    solve()

Solution (Python):
def main():
    a,b,c,d = map(int, input().split())

    print(max(a*c, a*d, b*c, b*d))

if __name__ == "__main__":
    main()

Solution (Python):
import math
a, b, c, d = map(int, input().split())

p = a * c
q = b * d
r = a * d
s = b * c

print(max([p, q, r, s]))

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

if a >= 0 and b >= 0:
  if c >= 0 and d >= 0:
    print(b*d)
    
  elif c < 0 and d >= 0:
    print(b*d)
  
  elif c < 0 and d < 0:
    print(a*d)
    
elif a < 0 and b >= 0:
  if c >= 0 and d >= 0:
    print(b*d)
    
  elif c < 0 and d >= 0:
    print(max(c*a, b*d))
    
  elif c < 0 and d < 0:
    print(a*c)
    
elif a < 0 and b < 0:
  if c >= 0 and d >= 0:
    print(b*c)
    
  elif c < 0 and d >= 0:
    print(a*c)
    
  elif c < 0 and d < 0:
    print(a*c)

Solution (Python):
def main():
    a,b,c,d = map(int,input().split())
    if a>=0 and b>=0 and c>=0 and d>=0:
        return b*d
    elif a<=0 and b>=0 and c>=0 and d>=0:
        return b*d
    elif a<=0 and b<=0 and c>=0 and d>=0:
        return b*c
    elif a>=0 and b>=0 and c<=0 and d>=0:
        return b*d
    elif a<=0 and b>=0 and c<=0 and d>=0:
        return (max(a*c,b*d))
    elif a<=0 and b<=0 and c<=0 and d>=0:
        return a*c
    elif a>=0 and b>=0 and c<=0 and d<=0:
        return a*d
    elif a<=0 and b>=0 and c<=0 and d<=0:
        return a*c
    elif a<=0 and b<=0 and c<=0 and d<=0:
        return a*c

print(main())

Solution (Python):
input_line = input().split()

number = []
for i in range(4):
  number.append(int(input_line[i]))

multi = []
for i in range(2):
  for j in range(2,4):
    multi.append(number[i] *number[j]) 

multi.sort()
print(multi[3])

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

x = 0 
y = 0

if a < 0 and b < 0:
  if c < 0 and d < 0:
    x = a
    y = c
  elif c < 0 and d >= 0:
    x = a
    y = c
  elif c >= 0 and d >= 0:
    x = b
    y = c

if a < 0 and b >= 0:
  if c < 0 and d < 0:
    x = a
    y = c
  elif c < 0 and d >= 0:
    if a * c >= b * d:
      x = a
      y = c
    else:
      x = b
      y = d
  elif c >= 0 and d >= 0:
    x = b
    y = d
    
if a >= 0 and b >= 0:
  if c < 0 and d < 0:
    x = a
    y = d
  elif c < 0 and d >= 0:
    x = b
    y = d
  elif c >= 0 and d >= 0:
    x = b
    y = d  
  
  
print(x * y)

Solution (Python):
a, b, c, d = map(int, input().split(' '))
x = [0] * 4
x[0] = a * c
x[1] = a * d
x[2] = b * c
x[3] = b * d
x.sort()
print(x[3])

Solution (Python):
input_arr = list(map(int, input().rstrip().split()))
a = input_arr[0]
b = input_arr[1]
c = input_arr[2]
d = input_arr[3]

ans = -10**18
for i in [0, 1]:
    for j in [2, 3]:
        ans = max(ans, input_arr[i]*input_arr[j])

print(ans)

Solution (Python):
i = list(map(int, input().split()))

r = [ i[0]*i[2], i[1]*i[2], i[0]*i[3], i[1]*i[3] ]

print(max(r))

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

e = a * c
f = a * d
g = b * c
h = b * d

ans_list = [e, f, g, h]
ans = max(ans_list)

print(ans)

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

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

Solution (Python):

"""
Created on Sun Sep 13 21:03:42 2020

@author: naoki
"""

a,b,c,d = map(int, input().split())
ac = a*c
bd = b*d
ad = a*d 
bc = b*c

print(max(ac,bd,ad,bc))

Solution (Python):



arr = list(map(int, input().split()))
a = arr[0]*arr[2]
b = arr[0]*arr[3]
c = arr[1]*arr[2]
d = arr[1]*arr[3]

print(max(a, b, c, d))

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

result = a*c
result = max(result, a*d)
result = max(result, b*c)
result = max(result, b*d)
print(result)

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

max = a * c

if a * d > max:
  max = a * d
if b * c > max:
  max = b * c
if b * d > max:
  max = b * d
  
print(max)

Solution (Python):
a,b,c,d = map(int,input().split())
print(max([a*c,a*d,b*c,b*d]))

Solution (Python):
A = [int(x) for x in input().split()]

mx = -float('inf')

for i in range(2):
    for j in range(2, 4):
        k = A[i] * A[j]
        if k > mx:
            mx = k

print(mx)

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

print(max(a*c, a*d, b*c, b*d))

Solution (Python):
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))



a,b,c,d = LI()

val1 = a*c
val2 = a*d
val3 = b*c
val4 = b*d

print(max(val1,val2,val3,val4))

Solution (Python):
a, b, c, d = list(map(int, input().split()))

xs = [a, b]
if a < b and b == 0:
  xs.append(b - 1)
if a == 0 and a < b:
  xs.append(a + 1)

ys = [c, d]
if c < d and d == 0:
  ys.append(d - 1)
if c == 0 and c < d:
  ys.append(c + 1)

anses = []

for x in xs:
  for y in ys:
    anses.append(x * y)

print(max(anses))

Solution (Python):
a, b, c, d = map(int, input().split())
AC = a*c
AD = a*d
BC = b*c
BD = b*d
print(max(AC, AD, BC, BD))

Solution (Python):
import math

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

print(max(a*c,a*d,b*c,b*d))

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

Solution (Python):
a, b, c, d = map(int, input().split())
if a == 0 and b == 0 and c == 0 and d == 0:
    print(0)
else:
    if a == 0:
        a += 1
    if b == 0:
        b -= 1
    if c == 0:
        c += 1
    if d == 0:
        d -= 1
    print(max(a * c, a * d, b * c, b * d))

Solution (Python):
a,b,c,d = map(int,input().split())
ans = []
for i in c,d:
    ans.append(a*i)
for j in c,d:
    ans.append(b*j)

print(max(ans))

Solution (Python):
a,b,c,d = map(int, input().split())
array = []
array.append(a*c)
array.append(b*d)
array.append(a*d)
array.append(b*c)
if (a <= 0 and b >= 0) or (c <= 0 and d >= 0):
    array.append(0)
print(max(array))

Solution (Python):
a,b,c,d = input().split()
A=max(int(a)*int(c),int(b)*int(d))
B=max(int(a)*int(d),int(b)*int(c))
print(max(A,B))

Solution (Python):
a = list(map(int, input().split()))
z = []
z.append(a[0]*a[2])
z.append(a[0]*a[3])
z.append(a[1]*a[2])
z.append(a[1]*a[3])
sum = z[0]
for i in range(0,len(a)):
  if sum < z[i]:
    sum = z[i]
print(sum)

Solution (Python):
a_lst = list(map(int, input().split()))


first = a_lst[:2]
second = a_lst[2:]
check = []
for numbers in first:
    for dig in second:
        check.append(int(numbers) * int(dig))
print(max(check))

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


if a<=0<=b or c<=0<=d:
    print(max(a*c,a*d,b*c,b*d,0))

else:
    print(max(a*c,a*d,b*c,b*d))

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

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

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

print(max(a*c, a*d, b*c, b*d))

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

Solution (Python):
a, b, c, d = map(int, input().split())
anslist = [a*c, b*c, a*d, b*d]

print(max(anslist))

Solution (Python):
import math
a, b, c, d = map(int, input().split())

mx = - math.inf

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

print(mx)

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

ans = a * c
for x in [a, b]:
    for y in [c,d]:
        if x * y > ans:
            ans = x * y
print(ans)

Solution (Python):
num=list(map(int,input().split()))

max_num=['a','b','c','d']
max_num[0]=num[0]*num[2]    
max_num[1]=num[0]*num[3]    
max_num[2]=num[1]*num[2]    
max_num[3]=num[1]*num[3]    

print(max(max_num))

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

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

ac = a*c
ad = a*d
bc = b*c
bd = b*d



print(max([ac,ad,bc,bd]))

Solution (Python):
a, b, c, d = map(int, input().split())
x = a * c
y = a * d
z = b * c
u = b * d
print(max([x, y, z, u]))

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

Solution (Python):
a, b, c, d = map(int, input().split())
ans = None
for x in [max(a, b), min(a, b)]:
    for y in [max(c, d), min(c, d)]:
        if ans is None:
            ans = x*y
        else:
            ans = max(ans, x*y)
print(ans)

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

prod_list = [a*c,a*d,b*c,b*d]
print(max(prod_list))

Solution (Python):

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

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

ans = []
ans.append(a*c)
ans.append(a*d)
ans.append(b*c)
ans.append(b*d)

print(max(ans))

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

Solution (Python):
a,b,c,d = map(int, input().split())
result =  [a*c,a*d,b*c,b*d]
print(max(result))

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

print(max(a*c, a*d, b*c, b*d))

Solution (Python):
def main():
    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(a*d)
        else:
            print(a*c)
    elif b <= 0 and d >= 0:
        if c >= 0:
            print(b*c)
        else:
            print(a*c)
    elif b >= 0 and d >=0:
        print(max(b*d,a*c))
    
    
if __name__ == "__main__":
    main()

Solution (Python):
rangeNum = input().split()
ansNum = []


ansNum.append(int(rangeNum[0])*int(rangeNum[2]))
ansNum.append(int(rangeNum[0])*int(rangeNum[3]))


ansNum.append(int(rangeNum[1])*int(rangeNum[2]))
ansNum.append(int(rangeNum[1])*int(rangeNum[3]))

print(max(ansNum))

Solution (Python):
list1 = input()
list2 = list1.split()
a = int(list2[0])
b = int(list2[1])
c = int(list2[2])
d = int(list2[3])




x_min = a
x_max = b
y_min = c
y_max = d

answer_list = [x_max*y_max, x_max*y_min, x_min*y_max, x_min*y_min]

print(max(answer_list))

Solution (Python):
nums = [int(i) for i in input().split(" ")]
a = nums[0]
b = nums[1]
c = nums[2]
d = nums[3]

ac = a * c
ad = a * d;
bc = b * c
bd = b * d

print(max([ac, ad, bc, bd]))

Solution (Python):
a, b, c, d = [int(i) for i in input().split()]
ans0 = [a*c, a*d, b*c, b*d]
ans = ans0[0]
for i in range(1, 4):
    if ans0[i] > ans:
        ans = ans0[i]
print(ans)

Solution (Python):
a = list(map(int, input().split()))

maximam=-1000000000000000000000000000000000


for i in range(0,2):
    for j in range(2,4):
        kari=a[i]*a[j]
        maximam=max(maximam,kari)
    

print(maximam)

Solution (Python):
a,b,c,d=map(int, input().split())
p=[0]*4
p[0] = a * c
p[1] = a * d
p[2] = b * c
p[3] = b * d
z = max(p)
print(z)

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

if a >= 0 and c >= 0:
    print(b*d)
else :
    ac = a*c
    ad = a*d
    bc = b*c
    bd = b*d
    nums = [ac,ad,bc,bd]
    print(max(nums))