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



Sample input:
1 2 1 1


Sample output:
2

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
def resolve():
    a, b, c, d = list(map(int, input().split()))
    ans = -10 ** 9

    for x in (a, b):
        for y in (c, d):
            ans = max(ans, x * y)
    if (b == 0 and d > 0) or (b > 0 and d == 0):
        ans = 0

    print(ans)

resolve()

Submission status: Wrong Answer

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
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:
    if c>0:
      print(b*c)
    else:
      print(a*c)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if a[0]>=0 and a[2]>=0:
  print(a[1]*a[3])

if a[1]<=0 and a[3]<=0:
  print(a[0]*a[2])

if a[1]<0 and a[2]>0:
  if a[0]==0 or a[1]==0 or a[2]==0 or a[3]==0:
    print(0)
  else:
    print(a[0]*a[2])

if a[0]>0 and a[3]<0:
  if a[0]==0 or a[1]==0 or a[2]==0 or a[3]==0:
    print(0)
  else:
    print(a[0]*a[3])

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

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

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

else:
    print(b*c)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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))

Submission status: Wrong Answer

Solution code:
nums = [int(x) for x in input().split()]

sign = [0] * 4
for x in range(4):
    if nums[x] < 0:
        sign[x] = 1

result = min(nums[0:2]) * min(nums[2:])

if sum(sign) == 1 or sum(sign) == 0:
    result = max(nums[0:2]) * max(nums[2:])

if sum(sign) == 2:
    if (sign[0] == 1 and sign[1]) or (sign[2] == 1 and sign[3] == 1):
        if sign[0] == 1:
             result = max(nums[0:2]) * min(nums[2:])
        elif sign[2] == 1:
             result = min(nums[0:2]) * max(nums[2:])
    else:
        result = nums[1] * nums[3]

print(result)

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
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 b<=0 and c>=0:
  print(b*c)
elif a>=0 and d<=0:
  print(a*d)
elif a<0 and b>=0 and c<0 and d>=0:
  print(max([a*c, b*d]))
elif b<=0 and c<=0 and d>=0:
  print(a*c)
elif a<=0 and b>=0 and d<=0:
  print(a*c)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
x = input().split(" ")
a = int(x[0])
b = int(x[1])
c = int(x[2])
d = int(x[3])
ab = a + b
cd = c + d
con1 = a >= -10**9 and a <= b and b <= 10**9
con2 = c >= -10**9 and c <= d and d <= 10**9
def positive(a, b, c, d):
    if a >= b and c >= d:
        return a * c
    elif a >= b and c <= d:
        return a * d
    elif a <= b and c >= d:
        return b * c
    else:
        return b * d
def negativeLeft(a, b, c, d):
    if a >= b and c >= d:
        return a * d
    elif a >= b and c <= d:
        return a * c
    elif a <= b and c >= d:
        return b * d
    else:
        return b * c
def negativeRight(a, b, c, d):
    if a >= b and c >= d:
        return b * c
    elif a >= b and c <= d:
        return b * d
    elif a <= b and c >= d:
        return a * c
    else:
        return a * d
def negative(a, b, c, d):
    if a >= b and c >= d:
        return b * d
    elif a >= b and c <= d:
        return b * c
    elif a <= b and c >= d:
        return a * d
    else:
        return a * c
if con1 == True and con2 == True:
    if ab >= 0 and cd >= 0:
        print(positive(a, b, c, d))
    elif ab >= 0 and cd <= 0:
        print(negativeRight(a, b, c, d))
    elif ab <= 0 and cd >= 0:
        print(negativeLeft(a, b, c, d))
    else:
        print(negative(a, b, c, d))
else:
    print()

Submission status: Wrong Answer

Solution code:
def main():
    a,b,c,d=(int(x) for x in input().split())
    if b*d>=0:
        x=b
        y=d
        print(x*y)
    elif a<=0 and c<=0:
        x=a
        y=c
        print(x*y)
    elif b>d:
        x=a
        y=d
        print(x*y)
    elif b<d:
        x=b
        y=c
        print(x*y)
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


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

Submission status: Wrong Answer

Solution code:
a = list(map(int,input().split()))
max_a = -(10**30)
import itertools
for i in itertools.combinations(a,2) :
    #print(i[0]*i[1])
    if( i[0]*i[1] > max_a):
        max_a = i[0]*i[1]

print(max_a)

Submission status: Wrong Answer

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

elif b > 0 and d > 0:
    print(b * d)

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

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

Submission status: Wrong Answer

Solution code:
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:
    if d>0:
      print(b*c)
    else:
      print(b*c)

Submission status: Wrong Answer

Solution code:
def resolve():
    a, b, c, d = list(map(int, input().split()))
    ans = -10 ** 9
    for x in (a, b):
        for y in (c, d):
            ans = max(ans, x * y)

    print(ans)

resolve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
a,b,c,d=map(int,input().split())
if a<0 and b<0 and c>=0 and d>=0:
  print(b*c)
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*c)
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 and abs(a*c)>=abs(b*d):
  print(a*c)
else:
  print(b*d)

Submission status: Wrong Answer

Solution code:
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*d)
elif a<0 and b<0 and c<0 and d<0:
  print(a*c)
else:
  print(a*c)

Submission status: Wrong Answer

Solution code:
a,b,c,d=(int(x) for x in input().split())
ac=a*c
ad=a*d
bc=b*c
bd=b*d

if(ac>ad):
    if(ac>bc):
        if(ac>bd):
            print(ac)
        else:
            print(bd)
    else:
        if(bc>bd):
            print(bd)
        else:
            print(bd)
else:
    if(ad>bc):
        if(ad>bd):
            print(ad)
        else:
            print(bd)
    else:
        if(bc>bd):
            print(bd)
        else:
            print(bd)

Submission status: Wrong Answer

Solution code:
a = list(map(int,input().split()))
max_a = 10**30
import itertools
for i in itertools.combinations(a,2) :
    #print(i[0]*i[1])
    if( i[0]*i[1] > max_a):
        max_a = i[0]*i[i]

print(max_a)

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
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 b<=0 and c>=0:
  print(b*c)
elif a>=0 and d<=0:
  print(a*d)
elif a<0 and b>=0 and c<0 and d>=0:
  print(max([a*c, b*d]))
elif b<=0 and c<0 and d>=0:
  print(a*c)
elif a<0 and b>=0 and d<=0:
  print(a*c)

Submission status: Wrong Answer

Solution code:
a,b,c,d=map(int,input().split())
if (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(0)
elif (a<=0 and b<=0) and (c>=0 and d>=0):
    print(max(a*c,b*d,a*d,b*c))
elif (a<=0 and b>=0) and (c<=0 and d<=0):
    print(0)
elif (a>=0 and b>=0) and (c<=0 and d<=0):
    print(max(a*c,b*d,a*d,b*c))
elif (a>=0 and b>=0) and (c>=0 and d>=0):
    print(b*d)

Submission status: Wrong Answer

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

# Avoid using 0
if a == 0:
    a += 1
if b == 0:
    b -= 1
if c == 0:
    c += 1
if d == 0:
    d -= 1

if (a > 0 and b > 0 and c < 0 and d < 0) or (a < 0 and b < 0 and c > 0 and d > 0):
    # Return the max negative value
    print(-(min(abs(a), abs(b)) * min(abs(c), abs(d))))    
else:
    # Return the max positive value
    print(max(a * c, b * d))

Submission status: Wrong Answer

Solution code:
def main():
    a,b,c,d=(int(x) for x in input().split())
    if b*d>0:
        x=b
        y=d
        print(x*y)
    elif a<=0 and c<=0:
        x=a
        y=c
        print(x*y)
    elif b>d:
        x=a
        y=d
        print(x*y)
    elif b<d:
        x=b
        y=c
        print(x*y)
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
a,b,c,d = (int(x) for x in input().split())
print(b*d)

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
a, b, c, d = map(int, input().split())
if b * d >= 0:
  print(b * d)
else:
  z = []

  for x in range(a, b + 1):
    for y in range(c, d + 1):
      z.append(x * y)
  print(max(z))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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(b*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)

#-+++
elif 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:
    if a*c > b*d:
        print(a*c)
    else:
        print(b*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)

#---+
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*c)

Submission status: Wrong Answer

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

a_b = [a, b]
c_d = [c, d]

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) * max(c_d))
elif max(c_d) > 0 and max(a_b) <= 0:
    print(min(c_d) * max(a_b))
elif max(a_b) <= 0 and max(c_d) <= 0:
    print(min(a_b) * min(c_d))

Submission status: Wrong Answer

Solution code:
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(a*c)
elif b>0 and d<0:
    print(a*d)
elif b>0 and d==0:
    print(b*d)
elif b>0 and d>0:
    print(b*d)

Submission status: Wrong Answer

Solution code:
if __name__ == "__main__":
    a, b, c, d = map(int, input().split())
    x_list = [a, b]
    y_list = [c, d]
    ans = 0

    if x_list[0] <= 0 and x_list[1] <= 0 and (y_list[0] >= 0 or y_list[1] >= 0):
        ans = max(x_list) * min(y_list)
    elif (x_list[0] >= 0 or x_list[1] >= 0) and y_list[0] <= 0 and y_list[1] <= 0:
        ans = max(y_list) * min(x_list)
    elif (x_list[0] <= 0 or x_list[1] <= 0) and (y_list[0] <= 0 or y_list[1] <= 0):
        ans = min(x_list) * min(y_list)
    else:
        ans = max(x_list) * max(y_list)

    print(ans)

Submission status: Wrong Answer

Solution code:
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*d)
elif 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(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*c)
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:
    x=a*c
    y=b*d
    print(x,y)
    if x>=y:
        print(x)
    else:
        print(y)

Submission status: Wrong Answer

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

elif b > 0 and d > 0:
    print(b * d)

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

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

Submission status: Wrong Answer

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

if b >= 0 and d >= 0 and a <= 0 and c <= 0:# - + - +
    e = b*d
    f = a*c
    if e > f:
        print(e)
    else:
        print(f)
elif 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("A")
    print(b*d)
elif a <= 0 and b <= 0 and c >= 0 and d >= 0: # - - + +
    print(b*c)
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(b*d)
elif a <= 0 and b >= 0 and c <= 0 and d <= 0: # - + - -
    print(a*c)

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
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)
else:
    print(b*c)

Submission status: Wrong Answer

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

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

print(ret)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

X = [a, b]
Y = [c, d]


X_minus = 0
Y_minus = 0
X_zero = 0
Y_zero = 0

for i in X:
    if i < 0:
        X_minus += 1
    elif i == 0:
        X_zero += 1
for i in Y:
    if i < 0:
        Y_minus += 1
    elif i == 0:
        Y_zero += 1

t = (X_minus, Y_minus)
z = (X_zero, Y_zero)

if z == (1,0) or (0,1):
    if t == (0,0):
        ans = max(X) * max(Y)
        print(ans)
        exit()
    elif t == (1,0) or (0,1):
        ans = 0
        print(ans)
        exit()
    elif t == (1,1):
        ans = min(X)*min(Y)
        print(ans)
        exit()
elif X_zero == 2 or Y_zero == 2:
    ans == 0
    print(ans)
    exit()

if t == (0,0) or t == (0,1) or t == (1,0) or t == (1,1) or t == (2,2):
    ans = max(X) * max(Y)
elif t == (0, 2) or t == (2, 0):
    ans = min(X) * max(Y)
elif t == (1, 2):
    ans = min(X) * min(Y)
elif t == (2, 1):
    ans = min(X) * min(Y)

print(ans)
exit()

Submission status: Wrong Answer

Solution code:
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(str(b*d))
elif b <= 0 and d <= 0:
    print(str(a*c))
elif b <= 0 and d > 0:
    print(str(b * c))
elif b > 0 and d <= 0:
    print(str(a * d))

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

a,b,c,d = map(int,input().split())
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 and b < 0 and d < 0:
    print(a*c)
elif a < 0 and c < 0 and b >= 0 and d >= 0 and a*c > b*d:
    print(a*c)
elif a < 0 and c < 0 and b >= 0 and d >= 0 and a*c < b*d:
    print(b*d)
elif a < 0 and b >= 0 and c >=0:
    print(b*d)
elif a < 0 and b < 0 and c >= 0:
    print(b * c)
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(d)

Submission status: Wrong Answer

Solution code:
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 or d <= 0):
  print(a * d)
elif (a <= 0 or b <= 0) and c >= 0 and d >= 0:
  print(b * c)

Submission status: Wrong Answer

Solution code:
inp = list(map(int,input().split()))
ans = []
for i in range(4):
  for j in range(i+1,4):
    ans.append(inp[i] * inp[j])
    
print(max(ans))

Submission status: Wrong Answer

Solution code:
a,b,c,d=(int(x) for x in input().split())
p=max(a*c,a*d,b*c,b*d)

Submission status: Wrong Answer

Solution code:
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 * c) 
elif(b < 0 and c > 0):
  print(b * d)

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
nums = [int(x) for x in input().split()]

sign = [0] * 4
for x in range(4):
    if nums[x] < 0:
        sign[x] = 1

result = min(nums[0:2]) * min(nums[2:])

if sum(sign) == 1 or sum(sign) == 0:
    result = max(nums[0:2]) * max(nums[2:])

if sum(sign) == 2:
    if (sign[0] == 1 and sign[1]) or (sign[2] == 1 and sign[3] == 1):
        if sign[0] == 1:
             result = max(nums[0:2]) * min(nums[2:])
        elif sign[2] == 1:
             result = min(nums[0:2]) * max(nums[2:])

print(result)

Submission status: Wrong Answer

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

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)
elif b <= 0 and d <= 0:
    print(a*c)

Submission status: Wrong Answer

Solution code:
a,b,c,d=list(map(int,input().split()))
if a>=0 and c>=0:
    one=b
    two=d

elif a<0 and c<0:
    one=a
    two=c

elif a>=0 and c<0:
    one=a
    two=d
else:
    one=b
    two=c


print(one*two)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

tmp = 0
if(len(a) != 4):
    exit()
if(a[0] > a[1]):
    tmp = a[1]
    a[1] = a[0]
    a[0] = tmp

if(a[2] > a[3]):
    tmp = a[3]
    a[3] = a[2]
    a[2] = tmp
a_len = a[1]
b_len = a[3]

if(a[0] < 0 and a[2] < 0):
    max = a[0] * a[2]
else:
    max = a_len * b_len
print(max)

Submission status: Wrong Answer

Solution code:
if __name__ == "__main__":
    a, b, c, d = map(int, input().split())
    x_list = [a, b]
    y_list = [c, d]
    ans = 0

    if x_list[0] <= 0 and x_list[1] <= 0 and y_list[0] >= 0 and y_list[1] >= 0:
        ans = max(x_list) * min(y_list)
    elif (x_list[0] >= 0 and x_list[1] >= 0 and y_list[0] <= 0 and y_list[1] <= 0):
        ans = max(y_list) * min(x_list)
    elif (x_list[0] <= 0 or x_list[1] <= 0) and (y_list[0] <= 0 or y_list[1] <= 0):
        ans = min(x_list) * min(y_list)
    else:
        ans = max(x_list) * max(y_list)

    print(ans)

Submission status: Wrong Answer

Solution code:
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 or d <= 0):
  print(a * d)
elif (a <= 0 or b <= 0) and c >= 0 and d >= 0:
  print(b * c)

Submission status: Wrong Answer

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

X = [a, b]
Y = [c, d]


X_minus = 0
Y_minus = 0
X_zero = 0
Y_zero = 0

for i in X:
    if i < 0:
        X_minus += 1
    elif i == 0:
        X_zero += 1
for i in Y:
    if i < 0:
        Y_minus += 1
    elif i == 0:
        Y_zero += 1

t = (X_minus, Y_minus)
z = (X_zero, Y_zero)

if z == (1,0) or (0,1):
    if t == (0,0):
        ans = max(X) * max(Y)
    elif t == (1,0) or (0,1):
        ans = 0
    elif t == (1,1):
        ans = min(X)*min(Y)
elif X_zero == 2 or Y_zero == 2:
    ans == 0

if t == (0,0) or t == (0,1) or t == (1,0) or t == (1,1) or t == (2,2):
    ans = max(X) * max(Y)
elif t == (0, 2) or t == (2, 0):
    ans = min(X) * max(Y)
elif t == (1, 2):
    ans = min(X) * min(Y)
elif t == (2, 1):
    ans = min(X) * min(Y)

print(ans)

Submission status: Wrong Answer

Solution code:
nums = [int(x) for x in input().split()]

sign = [0] * 4
for x in range(4):
    if nums[x] < 0:
        sign[x] = 1

result = min(nums[0:2]) * min(nums[2:])

if sum(sign) == 1 or sum(sign) == 0:
    result = max(nums[0:2]) * max(nums[2:])

if sum(sign) == 2:
    if (sign[0] == 1 and sign[1]) or (sign[2] == 1 and sign[3] == 1):
        if sign[0] == 0:
             result = max(nums[0:2]) * min(nums[2:])
        elif sign[2] == 0:
             result = min(nums[0:2]) * max(nums[2:])

print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

one = list(i[:2])
two = list(i[2:])

tmp = -10000000000

for i in one:
    for j in two:
        ans = i * j
        if ans > tmp:  
            tmp = ans

print(tmp)

Submission status: Wrong Answer

Solution code:
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 c > 0:
        print(b * c)
    elif d < 0:
        print(b * d)
    else:
        print(b * c)

Submission status: Wrong Answer

Solution code:
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:
			answer = a*d
		if d>=0:
			answer = b*d
print(answer)

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
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])

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
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 b<=0 and c>=0:
  print(b*c)
elif a>=0 and d<=0:
  print(a*d)
elif a<0 and b>=0 and c<0 and d>=0:
  print(max([a*c, b*d]))

Submission status: Wrong Answer

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

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