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 in C++ (GCC 9.2.1) (judge verdict: Accepted)

#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long int
#define ff first
#define ss second
typedef tree<pair<ll,ll>,null_type,less<pair<ll,ll>>,rb_tree_tag,
              tree_order_statistics_node_update>pbds;
//order_of_key:index number if it was there in sorted array
//find_by_order:value at 3rd index in sorted array.
const ll maxs=1e6+5;
ll root[maxs];

class cmp{
  bool operator()(const ll &a,const ll &b)
  {
      return a<b;
  }
};
void init()
{
    iota(root,root+maxs,0);
}
ll find(ll u)
{
    ll f;
    if(root[u]==u)
    return u;
    else
    {
        ll f=find(root[u]);
        root[u]=f;
        return f;
    }
}
void Union(ll x,ll y)
{
    ll u=find(x);
    ll v=find(y);
    root[v]=u;
}
ll power(ll x,ll y,ll p)
{
    ll res=1;
    x=x%p;
    while(y>0)
    {
        if(y&1)
        res=(res*x)%p;
        
        y=y>>1;
        x=(x*x)%p;
    }
    return res;
}
  

int main()
{
    ll t,n,i,k,y,x,j;
   ll a,b,c,d;
   cin>>a>>b>>c>>d;
   ll op1=a*d;
   ll op2=b*c;
   ll op3=b*d;
   ll op4=a*c;
   cout<<max(op1,max(op2,max(op3,op4)));
    return 0;
    
}