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)

/*
Author : NAKUL GUPTA 
24/08/2020 
1. You can sort the query if offline!
2. Don't bring the dp remaining state when dfsing on DP on Tree.
3. Try to reverse (Think from the back) if you stuck.
4. Be careful when submitting Div. 2 D-F, dont waste it on stupid WAs.
5. Try to reduce a problem, think of it when you're making subtasks
   like when problemsetting.
*/
#include <bits/stdc++.h>
using namespace std;
#define push_back emplace_back
#define int long long
typedef pair<int, int> pii; 
typedef vector<pii> vii;
typedef vector<int> vi;
#define ss second
#define ff first
#define pii pair<int, int>
#define max3(a, b, c) max(a, max(b, c))
#define TEST ll t; cin >> t;while (t--)
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
#define pq priority_queue<int>
#define getunique(v) {sort(all(v)); v.erase(unique(all(v)), v.end());}
#define endl "\n"
long long MAX(long long a,long long  b)
{
	return a > b ? a : b;
}
bool compare_2_coordinates(pair<int,int>&a , pair<int,int>&b)
{
	if(a.first == b.first)
	{
		if(a.second < 0 && b.second < 0)
		{
			return a.second > b.second;
		}
		else if(a.second >= 0 && b.second >=0)
		{
			return a.second < b.second;
		}
		else
		{
			return a.second > b.second;
		}
	}
	else
	{
		if(a.first <0 && b.first < 0)
		{
			return a.first > b.first;
		}
		else if(a.first>=0 && b.first >=0)
		{
			return a.first < b.first;
		}
		else
		{
			return a.first > b.first;
		}
		
	}
}

void fastio()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}
//count number of digits in a number in O(1)
int countDigit(int n) 
{ 
    return floor(log10(n) + 1); 
}
//count power with mod in log n
int power(int x, int y, int p)
{
    int res = 1; // Initialize result
    // Update x if it is more than or
    // equal to p
    x = x % p;
    while (y > 0) {
        // If y is odd, multiply x with the result
        if (y & 1)
            res = (res * x) % p;
        // y must be even now
        y = y >> 1; // y = y/2
        x = (x * x) % p;
		}return res;
}
int getminvertex(bool * visited,int n,int *dist)
{
    int minvertex=-1;
    for(int i=0;i<n;i++)
    {
        if(!visited[i] &&(minvertex == -1 ||dist[i]<dist[minvertex]))
            minvertex=i;
    }
        
        return minvertex;
    
}
void dijistra(int **edges,int n)
{
    bool *visited=new bool[n]{0};
    int *dist=new int[n];
    for(int i=0;i<n;i++)
        dist[i]=INT_MAX;
    
    dist[0]=0;
    
    for(int i=0;i<n-1;i++)
    {
        int minvertex=getminvertex(visited,n,dist);
        visited[minvertex]=true;
        for(int j=0;j<n;j++)
        {
            if(edges[minvertex][j] && !visited[j])
            {
                int curdi=edges[minvertex][j]+dist[minvertex];
                if(dist[j]>curdi)
                {
                    dist[j]=curdi;
                }
            }
        }
    }
    for(int i=0;i<n;i++)
    {
        cout<<i<<" "<<dist[i]<<endl;
    }
}
class graph
{
    public:
    int sv;
    int ev;
    int weight;
};
bool compare(graph v1,graph v2)
{
    return v1.weight < v2.weight;
}
int getparent(int v,int *parent)
{
    if(parent[v]==v)
        return v;
    return getparent(parent[v],parent);
}
graph* kruskal(graph*edges,int n,int e)
    
{
    sort(edges,edges+e,compare);
    int *parent=new int[n];
    for(int i=0;i<n;i++)
    {
        parent[i]=i;
    }
    graph* output=new graph[n-1];
    int count=0;
    int i=0;
    while(count<n-1){
        graph curredge=edges[i];
        int srsparent=getparent(curredge.sv,parent);
        int destparent=getparent(curredge.ev,parent);
        
        if(srsparent!=destparent)
        {
            output[count]=curredge;
            count+=1;
            parent[srsparent]=destparent;
            
        }
        i++;
    }
    return output;
}
bool dfs(int v1,int v2,bool *visited,int ** edges,int n)
{
    visited[v1]=1;
    if(v1==v2)
        return true;
    
    for(int i=0;i<n;i++)
    {
           /* if(i==v2)
                return true;*/
        
        if(edges[v1][i]==1){
        if(!visited[i])
        {
          
            
            bool a= dfs(i,v2,visited,edges,n);
            if(a)
                return true;
        }
        }
    }
    
    return false;
    
}
int32_t main() {
	fastio();
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	int x=a*c;
	int y=a*d;
	int z=b*c;
	int e=b*d;
	cout<<max(x,max(y,max(z,e)))<<endl;
	
	return 0;
}