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# (.NET Core 3.1.201) (judge verdict: Accepted)

using System;
using System.Numerics;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace debug
{
    class main
    {
        static void Main(string[] args)
        {
            //問題クラスを展開
            ProgramB a = new ProgramB();
            a.main();//実行する

        }

    }
    //ABC178
    class ProgramA
    {
        public void main()
        {
            //入力
            string s = Console.ReadLine();
            //30以上ならYes、それ以外はNoを出力
            if(s == "0")
                Console.WriteLine(1);
            else
                Console.WriteLine(0);


        }
    }

    class ProgramB
    {
        public void main()
        {
            //入力

            string[] s = Console.ReadLine().Split(' ');
            long a = long.Parse(s[0]);
            long b = long.Parse(s[1]);
            long c = long.Parse(s[2]);
            long d = long.Parse(s[3]);
            long max1 = Math.Max(a * c, a * d);
            long max2 = Math.Max(b * c, b * d);

            Console.WriteLine(Math.Max(max1, max2));

        }
    }

    class ProgramC
    {
        public void main()
        {

            //入力
            long n = long.Parse(Console.ReadLine());
            string[] s = Console.ReadLine().Split(' ');

            long count = 0;
            long min = long.Parse(s[0]);
            for(int i = 1;i < n;i++)
            {
                long temp = long.Parse(s[i]);
                if(temp < min)
                {
                    count += min - temp;
                }
                else
                {
                    min = temp;
                }

            }

            Console.WriteLine(count);


        }
    }

    class ProgramD
    {
        public void main()
        {
            string[] a = Console.ReadLine().Split(' ');
            long r = long.Parse(a[0]);
            long c = long.Parse(a[1]);
            string[] b = Console.ReadLine().Split(' ');
            long sx = long.Parse(b[0]);
            long sy = long.Parse(b[1]);
            string[] e = Console.ReadLine().Split(' ');
            long gx = long.Parse(e[0]);
            long gy = long.Parse(e[1]);

            long[,] maze = new long[r, c];
            long[,] w = new long[r, c];

            //迷路作成
            for (long i = 0; i < r; i++)
            {
                string d = Console.ReadLine();
                for (int j = 0; j < c; j++)
                {
                    if (d[j] == '#')
                        maze[i, j] = 1;
                    else
                        maze[i, j] = 0;

                }

            }

            for (int i = 0; i < r; i++)
                for (int j = 0; j < c; j++)
                    w[i, j] = 1000000000;

            //キューを用意
            Queue<long> qx = new Queue<long>();
            Queue<long> qy = new Queue<long>();
            Queue<long> ww = new Queue<long>();
            List<long> ans = new List<long>();

            //スタートを入れる
            qx.Enqueue(sx - 1);
            qy.Enqueue(sy - 1);

            ww.Enqueue(0);
            maze[sx - 1, sy - 1] = -1;
            w[sx - 1, sy - 1] = 0;

            while (qx.Count != 0)
            {
                long num = qx.Count;
                for (long i = 0; i < num; i++)
                {
                    long tx = qx.Dequeue();
                    long ty = qy.Dequeue();
                    long wnum = ww.Dequeue();

                    if (tx == gx - 1 && ty == gy - 1)
                        continue;

                    if (w[tx, ty] < wnum)
                        continue;

                    for (long x = -2; x <= 2; x++)
                        for (long y = -2; y <= 2; y++)
                        {
                            long karix = tx - x;
                            long kariy = ty - y;

                            if (x == 0 && y == 0)
                                continue;

                            if (0 <= karix && karix < r && 0 <= kariy && kariy < c)
                            {

                                if (maze[karix, kariy] == 0)
                                {
                                    if (Math.Abs(x) + Math.Abs(y) == 1)
                                    {
                                        if (wnum < w[karix, kariy])
                                        {
                                            qx.Enqueue(karix);
                                            qy.Enqueue(kariy);
                                            ww.Enqueue(wnum);
                                            w[karix, kariy] = wnum;
                                        }
                                    }
                                    else
                                    {
                                        if (wnum + 1 < w[karix, kariy])
                                        {
                                            qx.Enqueue(karix);
                                            qy.Enqueue(kariy);
                                            ww.Enqueue(wnum + 1);
                                            w[karix, kariy] = wnum + 1;
                                        }

                                    }

                                }
                            }
                        }

                }

            }

            if(w[gx -1,gy-1] == 1000000000)
                Console.WriteLine(-1);
            else
                Console.WriteLine(w[gx - 1, gy - 1]);
        }
    }

    class ProgramE
    {

        public void main()
        {
            //入力
            string[] s = Console.ReadLine().Split(' ');
            long h = long.Parse(s[0]);
            long w = long.Parse(s[1]);
            long m = long.Parse(s[2]);

            long[] a = new long[m];
            long[] b = new long[m];
            long[] ac = new long[h];
            long[] bc = new long[w];
            for (int i = 0; i < m; i++)
            {
                string[] t = Console.ReadLine().Split(' ');
                a[i] = long.Parse(t[0]);
                b[i] = long.Parse(t[1]);
                ac[a[i] - 1]++;
                bc[b[i] - 1]++;
            }

            long posh = 0;
            long posw = 0;

            long ansh = 0;
            long answ = 0;
            for (int i = 0; i < h; i++)
            {
                if (ansh < ac[i])
                {
                    ansh = ac[i];
                    posh = i + 1;
                }
            }

            for(int i = 0; i < w;i++)
            { 
                if (answ < bc[i])
                {
                    answ = bc[i];
                    posw = i + 1;
                }
            }

            long ans = ansh + answ;

            for (int i = 0; i < m; i++)
            {
                if (a[i] == posh && b[i] == posw)
                {
                    ans--;
                    break;
                }

            }

            Console.WriteLine(ans);
        }


    }

}