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: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:


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

ans=-(10**30)
ans=max(ans,a*c)
ans=max(ans,a*d)
ans=max(ans,b*d)
ans=max(ans,b*c)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:



def solve(A, B, C, D):
    return max(B * D, A * C, B * C, A * D)

if __name__ == "__main__":
    A, B, C, K = tuple(map(int, input().split(" ")))
    print(solve(A, B, C, K))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B, C, D = map(int, input().split())
if A <= 0 <= B or C <= 0 <= D:
    x = 0
else:
    x = -float('inf')

print(max(A * C, B * D, A * D, B * C, x))

Submission status: Accepted

Solution code:
a,b,c,d=map(int,input().split())
ac=a*c
ad=a*d
bc=b*c 
bd=b*d
print(max(ac,bc,ad,bd))

Submission status: Accepted

Solution code:
a, b, c, d = [int(i) for i in input().split()]
ans = b * d
ans = max(ans, a * d)
ans = max(ans, b * c)
ans = max(ans, a * c)
if a <= 0 and 0 <= b:
    ans = max(ans, 0)
if c <= 0 and 0 <= d:
    ans = max(ans, 0)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

L += [a*d]
L += [a*c]
L += [b*d]
L += [b*c]

print(max(L))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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

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

Submission status: Accepted

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

ans = -10**18
for i in [a,b]:
    for j in [c,d]:
        ans = max(ans,i*j)

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    a, b, c, d = [int(x) for x in input().split()]
    tu = (a * c, a * d, b * c, b * d)
    return max(tu)


if __name__ == '__main__':
    print(main())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c,d = map(int,input().split())
ans = -float("inf")
for x in [a,b]:
    for y in [c,d]:
        ans = max(ans,x*y)
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import time
startTimeProblem=time.time()

import fileinput, sys, itertools, functools
from math import *
from bisect import *
from heapq import *
from collections import *

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

class InputHelper:
    def __init__(self):
        self.myinput = fileinput.input()

    def isLocal(self):
        return not fileinput.isstdin()

    def int(self):
        return int(self.myinput.readline().rstrip())

    def ints(self):
        return [int(_) for _ in self.myinput.readline().rstrip().split()]

    def str(self):
        return self.myinput.readline().rstrip()

    def strs(self):
        return [_ for _ in self.myinput.readline().rstrip().split()]

class OutputHelper:
    def int(self, a):
        print(a)    

    def ints(self, a):  
        print(" ".join([str(_) for _ in a]))
    
    def intsNL(self, a):
        for _ in a:
            print(_)
    
    def str(self, s):
        print(s)

    def strs(self, s):
        print(" ".join([_ for _ in s]))

    def strsNL(self, s):
        for st in s:
            print(st)

class ListNode:
    def __init__(self, val):
        self.val = val
        self.next = None
        self.prev = None

In = InputHelper()
Out = OutputHelper()

######################################

a,b,c,d = In.ints()

Out.int(max([a*c, a*d, b*c,b*d]))

######################################

if len(sys.argv)>2 and sys.argv[2]=="TIMEIT":
    fin = (time.time()-startTimeProblem)*1000
    print("{:.2f}".format(fin) + "ms")

Submission status: Accepted

Solution code:
#from collections import deque,defaultdict
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7
#R = 998244353

def ddprint(x):
  if DBG:
    print(x)

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

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

print(max(n))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

def solve():
    a,b,c,d = map(int, input().split())
    return str(max(a*c,a*d,b*c,b*d))

if __name__ == '__main__':
    print(solve())

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
a, b, c, d = map(int, input().split())
t = -float("inf")
if 0 in range(a, b + 1) or (0 in range(c, d + 1)): t = 0
print(max(a * c, b * d, a * d, b * c, t))

Submission status: Accepted

Solution code:
import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
def celi(a,b):
    return -(-a//b)
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

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