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# (Mono-mcs 6.8.0.105) (judge verdict: Accepted)

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO.Pipes;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading;


class Test
{

    static long mod = (long)1e9 + 7;
    static long[] fact = new long[500001];
    static long[] factinv = new long[500001];
    // Driver code 
    public static void Main()
    {

        //var input = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
        //var t = input[0];
        //while (t > 0)
        //{
        //    t--;
        var input1 = Console.ReadLine().Split(' ').Select(xx => long.Parse(xx)).ToArray();
        var a = input1[0];
        var b = input1[1];
        var c = input1[2];
        var d = input1[3];

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

        var ans = Math.Max(bd, Math.Max(bc, Math.Max(ac, ad)));

        Console.WriteLine(ans);


        //    var m = Convert.ToInt32(input1[1]);
        //    var timePre = 0;
        //    var lowPre = 0;
        //    var hiPre = 0;
        //    bool check = true;
        //    for (int i = 0; i < n; i++)
        //    {
        //        var input2 = Console.ReadLine().Split(' ').Select(xx => int.Parse(xx)).ToArray();
        //        var time = input2[0];
        //        var low = input2[1];
        //        var hi = input2[2];

        //        if (i == 0)
        //        {
        //            if (Math.Abs((time - 0)) < low)
        //            {
        //                check = false;
        //                Console.WriteLine("NO");
        //                break;
        //            }
        //        }
        //        else
        //        {
        //            var diffTime = Math.Abs(time - timePre);

        //            var diffLow = diffTime - lowPre;
        //            var diffHigh = diffTime + lowPre;
        //            var diffhHigh = diffTime - hiPre;
        //            var diffhLow = diffTime + hiPre;
        //            bool checkF = false;
        //            if (diffLow >= low && diffLow <= hi)
        //            {
        //                checkF = true;
        //            }
        //            if (diffHigh >= low && diffHigh <= hi)
        //            {
        //                checkF = true;
        //            }
        //            if (diffhHigh >= low && diffhHigh <= hi)
        //            {
        //                checkF = true;
        //            }
        //            if (diffhLow >= low && diffhLow <= hi)
        //            {
        //                checkF = true;
        //            }

        //            if (!checkF)
        //            {
        //                Console.WriteLine("NO");
        //                check = false;
        //                break;
        //            }
        //        }

        //        timePre = time;
        //        lowPre = low;
        //        hiPre = hi;
        //    }
        //    if (check)
        //        Console.WriteLine("YES");
        //}

        //int[][] mat = new int[][] { new int[] { 0, 0 }, new int[] { 0, 0 }, new int[] { 1, 0 } };

       // NumSpecial(mat);
    }

    public static int NumSpecial(int[][] mat)
    {
        int count = 0;
        for (int i = 0; i < mat.Length; i++)
        {
            for (int j = 0; j < mat[0].Length; j++)
            {
                if (Verify(mat, i, j) && mat[i][j] == 1)
                {
                    count++;
                }
            }
        }

        return count;
    }

    public static bool Verify(int[][] mat, int i, int j)
    {
        int count1H = 0;
        int count1V = 0;
        for (int k = 0; k < mat[0].Length; k++)
        {
            if (mat[i][k] == 1 && k != j)
                count1H++;
        }
        for (int k = 0; k < mat.Length; k++)
        {
            if (mat[k][j] == 1 && k != i)
                count1V++;
        }


        if (count1V == 0 && count1H == 0)
            return true;
        return false;
    }

    public static int Max(int num)
    {
        int max = 0;
        while (num > 0)
        {
            var d = num % 10;

            if (d > max)
                max = d;
            num = num / 10;
        }
        return max;
    }

    public static bool Common(int a, int b)
    {
        var s1 = a.ToString();
        var s2 = b.ToString();
        for (int i = 0; i < s1.Length; i++)
            for (int j = 0; j < s2.Length; j++)
                if (s1[i] == s2[j])
                    return true;
        return false;

    }

    public static long BinarySearch(long[] arr, long val)
    {
        long low = 0;
        long high = arr.Length;
        while (low < high)
        {
            long middle = low + (high - low) / 2;
            if (arr[middle] > val)
                high = middle;
            else
                low = middle + 1;
        }
        return low;
    }
    public static void Run()
    {
        fact[0] = 1;
        factinv[0] = fast_pow(fact[0], mod - 2);
        for (int i = 1; i <= 500000; ++i)
        {
            fact[i] = fact[i - 1] * i % mod;
            factinv[i] = fast_pow(fact[i], mod - 2);
        }
    }
    public static long GetCom(int n, int r)
    {
        return fact[n] * factinv[r] % mod * factinv[n - r] % mod;
    }
    public static long fast_pow(long a, long b)
    {
        if (b == 0)
            return 1;
        long val = fast_pow(a, b / 2);
        if (b % 2 == 0)
            return val * val % mod;
        else
            return val * val % mod * a % mod;
    }

}