stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <bits/stdc++.h>

#define f first

#define s second

using namespace std;

typedef long long ll;

typedef pair<ll,ll> P;

typedef pair<ll,P> PP;

const int MAX_N = 1<<19;

 

/*    BIT  sum:O(logN)   add:O(logN)  */

 

//[1,n]

class BIT{

public:

  int bit[MAX_N+1],n;

  BIT(){memset(bit,0,sizeof(bit));}

  BIT(int n){this->n=n,memset(bit,0,sizeof(bit));}

 

  int sum(int i){

    int s=0;

    while(i>0){

      s+=bit[i];

      i-=i&-i;

    }

    return s;

  }

   

  void add(int i,int x){

    while(i<=n){

      bit[i]+=x;

      i+=i&-i;

    }

  }

};

 

 

ll n,p,Q;

PP C[MAX_N];

 

int main(){

  cin>>n>>p>>Q;

  BIT B(n);

 

  for(int i=0;i<n;i++){

    cin>>C[i].s.f;

    C[i].s.s=i+1;

    C[i].f=-(n-i-1)*p+C[i].s.f;

  }

  sort(C,C+n,greater<PP>());

 

  ll sum=n*(2*Q*p+(n-1)*p)/2,ans=sum;

  for(int i=0;i<n;i++){

    ll idx=C[i].s.s,cost=C[i].s.f;

    ll l=B.sum(idx),r=i-l;

    sum+=-(Q+(idx-1)-l*2)*p-(n-idx-r)*p*2+cost;

    B.add(idx,1);

    ans=max(ans,sum);

  }

  cout<<ans<<endl;

   

  return 0;

}

// Faster C++ solution for the same problem (measured speedup: 3.119989245409622x):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

ll n,p,Q;



ll calc(ll a,ll l,ll n){return (a+l)*n/2;}



int main(){

  cin>>n>>p>>Q;

  vector<ll> V;

  

  for(int i=0;i<n;i++){

    ll C;

    cin>>C;

    V.push_back(C-p*(Q+i)-2*p*(n-i-1));

  }



  sort(V.begin(),V.end(),greater<ll>());

  ll sum = p*calc(Q,Q+n-1,n);

  ll ans = sum;

  for(int i=0;i<n;i++){

    sum += V[i]+ 2*p*i ;

    ans =max(ans,sum);

  }

  cout<<ans<<endl;

  return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main(){

    ios_base::sync_with_stdio(false);

    cin.tie(nullptr);



    long long a, b, c, d, x, y;

    cin >> a >> b >> c >> d;

    long long ara[5];

    ara[0] = a*c, ara[1] = a*d, ara[2] = b*c, ara[3] = b*d;

    long long maxi = ara[0];

    for(int i=0; i<4 ; i++){

        if(maxi < ara[i]) maxi = ara[i];

    }

    cout << maxi << endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.309412530240193x):
#include <stdio.h>

typedef long long LL;





int main()

{	 

	int i;

	LL a, b, c, d, x[4], ans;

		

	scanf("%lld%lld%lld%lld", &a, &b, &c, &d);

	x[0] = a * c, x[1] = a * d;

	x[2] = b * c, x[3] = b * d;

	for(ans = x[0], i = 1; i < 4; i++){

		if(x[i] > ans) ans = x[i];

	}

	printf("%lld\n", ans);

		

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main(){

    ios_base::sync_with_stdio(false);

    cin.tie(nullptr);



    long long a, b, c, d, x, y;

    cin >> a >> b >> c >> d;

    long long ara[5];

    ara[0] = a*c, ara[1] = a*d, ara[2] = b*c, ara[3] = b*d;

    long long maxi = ara[0];

    for(int i=0; i<4 ; i++){

        if(maxi < ara[i]) maxi = ara[i];

    }

    cout << maxi << endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.301639746462089x):
#include<stdio.h>

#include<algorithm>



using namespace std;

int main()

{

	long long a,b,c,d;

	while(~scanf("%lld%lld%lld%lld",&a,&b,&c,&d))

	{

		long long n;

		n=max(a*c,a*d);

		n=max(n,c*b);

		n=max(n,b*d);

		printf("%lld\n",n);

	}

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <algorithm>

#include <queue>

#include <cstring>

#include <cstdio>

#include <set>

#include <map>



const int MAXN = 2e5 + 10;

typedef long long ll;



using namespace std;



int main()

{

	ll a, b, c, d, x, y;

	cin >> a >> b >> c >> d;

	ll maxn = a*c;

	maxn = max(maxn, a*d);

	maxn = max(maxn, b*c);

	maxn = max(maxn, b*d);

	cout << maxn <<endl;

	return 0;

} 

// Faster C++ solution for the same problem (measured speedup: 5.233713475567374x):
#include<stdio.h>

#include<algorithm>



using namespace std;

int main()

{

	long long a,b,c,d;

	while(~scanf("%lld%lld%lld%lld",&a,&b,&c,&d))

	{

		long long n;

		n=max(a*c,a*d);

		n=max(n,c*b);

		n=max(n,b*d);

		printf("%lld\n",n);

	}

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

#include <iostream>

#include<algorithm>

using namespace std;



int main() {

	long long int a,b,c,d,z[4]={0};

	cin>>a>>b>>c>>d;

	z[0]=a*c;

	z[1]=a*d;

	z[2]=b*c;

	z[3]=b*d;

	long long int sum=-1000000000000000000;

	for(int i=0;i<4;i++){

		if(z[i]>sum){

			sum=z[i];

		}

	}

	cout<<sum;

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.225539294653297x):
#include<stdio.h>

#include<algorithm>



using namespace std;

int main()

{

	long long a,b,c,d;

	while(~scanf("%lld%lld%lld%lld",&a,&b,&c,&d))

	{

		long long n;

		n=max(a*c,a*d);

		n=max(n,c*b);

		n=max(n,b*d);

		printf("%lld\n",n);

	}

	return 0;

}
// Slower C++ solution:
#include <iostream>

using namespace std;

long long a[10];

int main(){

	for(int i = 1;i <= 4;i++)

		cin >> a[i];

	long long res;

	res = a[1]*a[3];

	for(int i = 1;i <= 2;i++){

		for(int j = 3;j <= 4;j++){

			res = max(res,a[i]*a[j]);

		}

	}

	cout << res;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.226209926370477x):
#include<stdio.h>

#include<algorithm>



using namespace std;

int main()

{

	long long a,b,c,d;

	while(~scanf("%lld%lld%lld%lld",&a,&b,&c,&d))

	{

		long long n;

		n=max(a*c,a*d);

		n=max(n,c*b);

		n=max(n,b*d);

		printf("%lld\n",n);

	}

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main(){

    ios_base::sync_with_stdio(false);

    cin.tie(nullptr);



    long long a, b, c, d, x, y;

    cin >> a >> b >> c >> d;

    long long ara[5];

    ara[0] = a*c, ara[1] = a*d, ara[2] = b*c, ara[3] = b*d;

    long long maxi = ara[0];

    for(int i=0; i<4 ; i++){

        if(maxi < ara[i]) maxi = ara[i];

    }

    cout << maxi << endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.3087685781379985x):
#include<stdio.h>



long long int max(long long int a, long long int b, long long int c, long long int d)

{

	if(a > b && a > c && a > d) return a;

	else if(b > a && b > c && b > d) return b;

	else if(c > b && c > a && c > d) return c;

	else return d;

}



int main()

{

	long long int a, b, c, d;

	scanf("%lld %lld %lld %lld", &a, &b, &c, &d);

	printf("%lld\n", max(a*c, a*d, b*c, b*d));

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <algorithm>

#include <queue>

#include <cstring>

#include <cstdio>

#include <set>

#include <map>



const int MAXN = 2e5 + 10;

typedef long long ll;



using namespace std;



int main()

{

	ll a, b, c, d, x, y;

	cin >> a >> b >> c >> d;

	ll maxn = a*c;

	maxn = max(maxn, a*d);

	maxn = max(maxn, b*c);

	maxn = max(maxn, b*d);

	cout << maxn <<endl;

	return 0;

} 

// Faster C++ solution for the same problem (measured speedup: 5.240750970416426x):
#include<stdio.h>



long long int max(long long int a, long long int b, long long int c, long long int d)

{

	if(a > b && a > c && a > d) return a;

	else if(b > a && b > c && b > d) return b;

	else if(c > b && c > a && c > d) return c;

	else return d;

}



int main()

{

	long long int a, b, c, d;

	scanf("%lld %lld %lld %lld", &a, &b, &c, &d);

	printf("%lld\n", max(a*c, a*d, b*c, b*d));

}
// Slower C++ solution:
#include <bits/stdc++.h>

#include <iostream>

#include<algorithm>

using namespace std;



int main() {

	long long int a,b,c,d,z[4]={0};

	cin>>a>>b>>c>>d;

	z[0]=a*c;

	z[1]=a*d;

	z[2]=b*c;

	z[3]=b*d;

	long long int sum=-1000000000000000000;

	for(int i=0;i<4;i++){

		if(z[i]>sum){

			sum=z[i];

		}

	}

	cout<<sum;

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.232565798118058x):
#include<stdio.h>



long long int max(long long int a, long long int b, long long int c, long long int d)

{

	if(a > b && a > c && a > d) return a;

	else if(b > a && b > c && b > d) return b;

	else if(c > b && c > a && c > d) return c;

	else return d;

}



int main()

{

	long long int a, b, c, d;

	scanf("%lld %lld %lld %lld", &a, &b, &c, &d);

	printf("%lld\n", max(a*c, a*d, b*c, b*d));

}
// Slower C++ solution:
#include <iostream>

using namespace std;

long long a[10];

int main(){

	for(int i = 1;i <= 4;i++)

		cin >> a[i];

	long long res;

	res = a[1]*a[3];

	for(int i = 1;i <= 2;i++){

		for(int j = 3;j <= 4;j++){

			res = max(res,a[i]*a[j]);

		}

	}

	cout << res;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.2332373315978735x):
#include<stdio.h>



long long int max(long long int a, long long int b, long long int c, long long int d)

{

	if(a > b && a > c && a > d) return a;

	else if(b > a && b > c && b > d) return b;

	else if(c > b && c > a && c > d) return c;

	else return d;

}



int main()

{

	long long int a, b, c, d;

	scanf("%lld %lld %lld %lld", &a, &b, &c, &d);

	printf("%lld\n", max(a*c, a*d, b*c, b*d));

}
// Slower C++ solution:
#include<iostream>

#include<algorithm>

#include<cstring>

typedef long long ll;

using namespace std;

int main()

{

	ll a[3],b[3],s[10];

	for(int i=0;i<2;i++) cin>>a[i];

	for(int i=0;i<2;i++) cin>>b[i];

	int t=0;

	for(int i=0;i<2;i++)

	{

		for(int j=0;j<2;j++)

		{

			ll sum=a[i]*b[j];

			s[t++]=sum;

		}

	}

	sort(s,s+t);

	printf("%lld\n",s[t-1]);

} 

// Faster C++ solution for the same problem (measured speedup: 5.224715660196937x):
#include<stdio.h>



long long int max(long long int a, long long int b, long long int c, long long int d)

{

	if(a > b && a > c && a > d) return a;

	else if(b > a && b > c && b > d) return b;

	else if(c > b && c > a && c > d) return c;

	else return d;

}



int main()

{

	long long int a, b, c, d;

	scanf("%lld %lld %lld %lld", &a, &b, &c, &d);

	printf("%lld\n", max(a*c, a*d, b*c, b*d));

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

int main() {

    long long a,b,c,d;

    cin>>a>>b>>c>>d;

    long long ans;

    ans=max(a*c, a*d);

    ans=max(ans, b*c);

    ans=max(ans, b*d);

    cout<<ans<<"\n";

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.244000205061545x):
#include<stdio.h>



long long int max(long long int a, long long int b, long long int c, long long int d)

{

	if(a > b && a > c && a > d) return a;

	else if(b > a && b > c && b > d) return b;

	else if(c > b && c > a && c > d) return c;

	else return d;

}



int main()

{

	long long int a, b, c, d;

	scanf("%lld %lld %lld %lld", &a, &b, &c, &d);

	printf("%lld\n", max(a*c, a*d, b*c, b*d));

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

#define mod 1000000007

int main()

{

ll a,b,c,d,e,f,g,h,t,tt,ans;

cin>>a>>b>>c>>d;

e=a*c;

f=a*d;

g=b*c;

h=b*d;

t=max(e,f);

tt=max(g,h);

ans=max(t,tt);

cout<<ans<<endl;

}


// Faster C++ solution for the same problem (measured speedup: 5.240750970416426x):
#include<stdio.h>



long long int max(long long int a, long long int b, long long int c, long long int d)

{

	if(a > b && a > c && a > d) return a;

	else if(b > a && b > c && b > d) return b;

	else if(c > b && c > a && c > d) return c;

	else return d;

}



int main()

{

	long long int a, b, c, d;

	scanf("%lld %lld %lld %lld", &a, &b, &c, &d);

	printf("%lld\n", max(a*c, a*d, b*c, b*d));

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

int main()

{

    long long int a,b,c,d;

    cin >> a >> b >> c >> d;

    long long int i,j,k,l;

    i = a*c;

    j = b*c;

    k = a*d;

    l = b*d;

    cout << max(i,max(j,max(k,l))) << endl;

}


// Faster C++ solution for the same problem (measured speedup: 5.240750970416426x):
#include<stdio.h>



long long int max(long long int a, long long int b, long long int c, long long int d)

{

	if(a > b && a > c && a > d) return a;

	else if(b > a && b > c && b > d) return b;

	else if(c > b && c > a && c > d) return c;

	else return d;

}



int main()

{

	long long int a, b, c, d;

	scanf("%lld %lld %lld %lld", &a, &b, &c, &d);

	printf("%lld\n", max(a*c, a*d, b*c, b*d));

}
// Slower C++ solution:
/*

   * * * * *       *        * * * * * * * * * * * * * * * * * * * * * * * *     * * * * * * *               * *               * * * * * * * * * *

   * * * * *      * *       * * * * * * * * * * * * * * * * * * * * * *    *    * * * * * * *              * * *             * ** * * * * * * * * *

   * *           * * *            * *     * *     * *      * *          * * *   * * *       *             * * * *           * * * *       * *    * *

   * * * * *    * * * *           * *     * *     * *       * * * * * * *  * *  * * * * * * *            * * * * *         * *  * *       * * * * *

   * * * * *   * * * * *          * *     * *     * *        * * * * ** *   * * * * * * * * *           * * * * * *       * *   * * * *   * * * *

         * *  * * * * * *   * *   * *     * *     * *       * * * * * * *    * ** *     * * *          * * * * * * *     * *    * * * *   * *  * *

         * * * *       * *  * *   * *     * *     * *      * *          *     * * *     * * *         * *       * * *   * *     * *       * *   * *

   * * * * ** *         * * * * * * * * * * * * * * * * * * * * * * * * *      *  * * * * * * * * * ** *         * * * * *      * * * * * * *    * *

   * * * * * *           * ** * * * * * * * * * * * * * * * * * * * * * *       * * * * * * * * * * * *           * * * *       * * * * * * *     * *

*/

 

#include <iostream>

#include <algorithm>

#include <string>

#include <vector>

#include <cstdio>

#include <cmath>

#include <cstring>

#include <cstdlib>

#include <set>

#define ll long long

#define rep(i, a, b) for (int i = int(a); i <= int(b); i++)

#define sz(a) int((a).size())

#define shit while(t--)

#define fr for(int i=0;i<n;i++)

int maxo=1e9+7;

using namespace std;

int arr[95];

int main()

{

    ios::sync_with_stdio(0);

    cin.tie(0);

    ll a,b,c,d,ans=-1000000000000000000;

    cin>>a>>b>>c>>d;

 

    ans=max(ans,a*c);

    ans=max(ans,a*d);

    ans=max(ans,c*b);

    ans=max(ans,d*b);

 

    cout<<ans<<endl;

 

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.308931851931204x):
#include<stdio.h>



long long int max(long long int a, long long int b, long long int c, long long int d)

{

	if(a > b && a > c && a > d) return a;

	else if(b > a && b > c && b > d) return b;

	else if(c > b && c > a && c > d) return c;

	else return d;

}



int main()

{

	long long int a, b, c, d;

	scanf("%lld %lld %lld %lld", &a, &b, &c, &d);

	printf("%lld\n", max(a*c, a*d, b*c, b*d));

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main()

{

	long long int n,i,j,a,b,c,d,ara[4];

	cin>>a>>b>>c>>d;

	ara[0]=a*c;

	ara[1]=a*d;

	ara[2]=b*c;

	ara[3]=b*d;

	sort(ara,ara+4);

	cout<<ara[3]<<'\n';

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.238127159123595x):
#include<stdio.h>



long long int max(long long int a, long long int b, long long int c, long long int d)

{

	if(a > b && a > c && a > d) return a;

	else if(b > a && b > c && b > d) return b;

	else if(c > b && c > a && c > d) return c;

	else return d;

}



int main()

{

	long long int a, b, c, d;

	scanf("%lld %lld %lld %lld", &a, &b, &c, &d);

	printf("%lld\n", max(a*c, a*d, b*c, b*d));

}
// Slower C++ solution:
#include<iostream>

#include<algorithm>

using namespace std;

typedef long long ll;

int main(){

	ll a,b,c,d;

    cin>>a>>b>>c>>d;

    ll maxx=0;

    ll a1=a*c;

    ll b1=a*d;

    ll c1=b*c;

    ll d1=b*d;

    cout<<max(max(a1,b1),max(c1,d1))<<endl;



	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.240750970416426x):
#include<stdio.h>



long long int max(long long int a, long long int b, long long int c, long long int d)

{

	if(a > b && a > c && a > d) return a;

	else if(b > a && b > c && b > d) return b;

	else if(c > b && c > a && c > d) return c;

	else return d;

}



int main()

{

	long long int a, b, c, d;

	scanf("%lld %lld %lld %lld", &a, &b, &c, &d);

	printf("%lld\n", max(a*c, a*d, b*c, b*d));

}
// Slower C++ solution:
/**

 * author  : UshanGhosh

 * created : 2020-09-19 17:13:12

**/ 



#include<bits/stdc++.h>

using namespace std;



#define    ll      long long

#define    pii     pair<int,int>

#define    vii     vector<int>

#define    vcc     vector<char>

#define    pll     pair<long long, long long>

#define    mem     memset

#define    sof     sizeof

#define    co1     __builtin_popcountll

#define    PB      push_back

#define    UB      upper_bound

#define    LB      lower_bound

#define    MP      make_pair

#define    TS      to_string

#define    F       first

#define    S       second

#define    pi      acos(-1)

#define    mod     (int)1e9+7

#define    inf     (long long)1e18

#define    endl    '\n'



int main()

{

    ios_base::sync_with_stdio(0);

    cin.tie(0);

    long long a,b,c,d,e,f,i,j,k,m,n,o,x,y;

    cin>>a>>b>>c>>d;

    ll ans = max(a*c,max(a*d,max(b*c,b*d)));

    cout<<ans<<"\n";

}

// Faster C++ solution for the same problem (measured speedup: 5.315255157305038x):
#include<stdio.h>



long long int max(long long int a, long long int b, long long int c, long long int d)

{

	if(a > b && a > c && a > d) return a;

	else if(b > a && b > c && b > d) return b;

	else if(c > b && c > a && c > d) return c;

	else return d;

}



int main()

{

	long long int a, b, c, d;

	scanf("%lld %lld %lld %lld", &a, &b, &c, &d);

	printf("%lld\n", max(a*c, a*d, b*c, b*d));

}
// Slower C++ solution:
#include<bits/stdc++.h>



using namespace std;



#define ios         ios_base::sync_with_stdio(false);

#define ll          long long

#define ld          long double

#define db(x)       cout << "[" << #x << ": " << (x) << "]\n"

#define db2(x,y)    cout << "[" << #x << ": " << (x) << "]  [" << #y << ": " << (y) << "]\n"

#define db3(x,y,z)  cout << "[" << #x << ": " << (x) << "]  [" << #y << ": " << (y) << "]  [" << #z << ": " << (z) << "]\n"

#define cn          23

#define sn          1007

#define bn          200007

#define M           100000007

#define inf         LLONG_MAX





int main()

{

        ios;

        ll a,b,c,d; cin >> a >> b >> c >> d;

        ll ac = a*c, ad = a*d, bc = b*c, bd = b*d;

        cout << max(max(max(ac,ad),bc),bd);

}


// Faster C++ solution for the same problem (measured speedup: 5.301293553499739x):
#include<stdio.h>



long long int max(long long int a, long long int b, long long int c, long long int d)

{

	if(a > b && a > c && a > d) return a;

	else if(b > a && b > c && b > d) return b;

	else if(c > b && c > a && c > d) return c;

	else return d;

}



int main()

{

	long long int a, b, c, d;

	scanf("%lld %lld %lld %lld", &a, &b, &c, &d);

	printf("%lld\n", max(a*c, a*d, b*c, b*d));

}
// Slower C++ solution:
#include<cstdio>

#include<cstring>

#include<iostream>

#include<algorithm>

using namespace std;



int main()

{

	long long a,b,c,d;

	cin>>a>>b>>c>>d;

	long long sum1,sum2,sum3,sum4,sum;

	sum1=a*c;

	sum2=a*d;

	sum3=b*c;

	sum4=b*d;

	sum=max(max(sum1,sum2),max(sum3,sum4));

	cout<<sum<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.240750970416426x):
#include<stdio.h>



long long int max(long long int a, long long int b, long long int c, long long int d)

{

	if(a > b && a > c && a > d) return a;

	else if(b > a && b > c && b > d) return b;

	else if(c > b && c > a && c > d) return c;

	else return d;

}



int main()

{

	long long int a, b, c, d;

	scanf("%lld %lld %lld %lld", &a, &b, &c, &d);

	printf("%lld\n", max(a*c, a*d, b*c, b*d));

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

#define mod 1000000007

int main()

{

ll a,b,c,d,e,f,g,h,t,tt,ans;

cin>>a>>b>>c>>d;

e=a*c;

f=a*d;

g=b*c;

h=b*d;

ans=max(max(e,f),max(g,h));

cout<<ans<<endl;

}

// Faster C++ solution for the same problem (measured speedup: 5.240750970416426x):
#include<stdio.h>



long long int max(long long int a, long long int b, long long int c, long long int d)

{

	if(a > b && a > c && a > d) return a;

	else if(b > a && b > c && b > d) return b;

	else if(c > b && c > a && c > d) return c;

	else return d;

}



int main()

{

	long long int a, b, c, d;

	scanf("%lld %lld %lld %lld", &a, &b, &c, &d);

	printf("%lld\n", max(a*c, a*d, b*c, b*d));

}
// Slower C++ solution:
//Mahir Ratanpara (DA-IICT)

#include<bits/stdc++.h>

using namespace std;

#define Ff(i,a,n) for(i=a;i<n;i++)

#define Fr(i,a,n) for(i=a;i>n;i--)

#define ll long long

#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);

#define pb push_back

#define ff first

#define ss second

#define all(x) x.begin(), x.end()

#define clr(x) memset(x, 0, sizeof(x))

#define sortall(x) sort(all(x))

#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)

typedef pair<ll, ll>	pa;

typedef vector<ll>		vc;

typedef vector<pa>		vp;

typedef vector<vc>		vvc;

int mpow(int base, int exp); 

void ipgraph(ll n,ll m);

void dfs(int u, int par);

const int mod = 1000000007;

const int N = 3e5, M = N;

//=======================



vc g[N];



int main() {

    FAST;

    ll t, i, l,j, k, p, q, r, x, y, u, v, n, m;

    n=4;

    vc a(n);

    Ff(i,0,n)

    cin>>a[i];



    ll maxi=-1e18;

    Ff(i,0,2)

    {

      Ff(j,2,n)

      {

        maxi=max(maxi,a[i]*a[j]);

      }

    }

    cout<<maxi<<"\n";

    return 0;

}



int mpow(int base, int exp) {

  base %= mod;

  int result = 1;

  while (exp > 0) {

    if (exp & 1) result = ((ll)result * base) % mod;

    base = ((ll)base * base) % mod;

    exp >>= 1;

  }

  return result;

}



void ipgraph(ll n, ll m){

	int i, u, v;

	while(m--){

		cin>>u>>v;

		g[u-1].pb(v-1);

		g[v-1].pb(u-1);

	}

}



void dfs(int u, int par){

	for(int v:g[u]){

		if (v == par) continue;

		dfs(v, u);

	}

}

// Faster C++ solution for the same problem (measured speedup: 9.448087815106293x):
#include<bits/stdc++.h>



using namespace std;

typedef long long ll;

int main(){ 

    ll a,b,c,d;

    cin>>a>>b>>c>>d;

    cout<<max(max(a*c,a*d),max(b*c,b*d))<<endl;

    return 0;

}
// Slower C++ solution:
//Mahir Ratanpara (DA-IICT)

#include<bits/stdc++.h>

using namespace std;

#define Ff(i,a,n) for(i=a;i<n;i++)

#define Fr(i,a,n) for(i=a;i>n;i--)

#define ll long long

#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);

#define pb push_back

#define ff first

#define ss second

#define all(x) x.begin(), x.end()

#define clr(x) memset(x, 0, sizeof(x))

#define sortall(x) sort(all(x))

#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)

typedef pair<ll, ll>	pa;

typedef vector<ll>		vc;

typedef vector<pa>		vp;

typedef vector<vc>		vvc;

int mpow(int base, int exp); 

void ipgraph(ll n,ll m);

void dfs(int u, int par);

const int mod = 1000000007;

const int N = 3e5, M = N;

//=======================



vc g[N];



int main() {

    FAST;

    ll t, i, l,j, k, p, q, r, x, y, u, v, n, m;

    n=4;

    vc a(n);

    Ff(i,0,n)

    cin>>a[i];



    ll maxi=-1e18;

    Ff(i,0,2)

    {

      Ff(j,2,n)

      {

        maxi=max(maxi,a[i]*a[j]);

      }

    }

    cout<<maxi<<"\n";

    return 0;

}



int mpow(int base, int exp) {

  base %= mod;

  int result = 1;

  while (exp > 0) {

    if (exp & 1) result = ((ll)result * base) % mod;

    base = ((ll)base * base) % mod;

    exp >>= 1;

  }

  return result;

}



void ipgraph(ll n, ll m){

	int i, u, v;

	while(m--){

		cin>>u>>v;

		g[u-1].pb(v-1);

		g[v-1].pb(u-1);

	}

}



void dfs(int u, int par){

	for(int v:g[u]){

		if (v == par) continue;

		dfs(v, u);

	}

}

// Faster C++ solution for the same problem (measured speedup: 9.448176146572239x):
#include<bits/stdc++.h>

#include<iostream>

#include<algorithm> 

#include<cstring>

#define ios ios::sync_with_stdio(false)

#define mem(arr) memset(arr,0,sizeof(arr))

using namespace std;

typedef long long ll;

const ll maxn = 1e6 + 10;

int main()

{

	ll a,b,c,d;

	ll sum;

	cin>>a>>b>>c>>d;

	sum = max(b * c,b * d);

	sum = max(sum,a * c);

	sum = max(sum,a * d);

	cout<<sum<<endl;

	return 0;

}