Problem:
Score : 100 points

Problem Statement

We have two integers: A and B.

Print the largest number among A + B, A - B, and A \times B.

Constraints

All values in input are integers.

-100 \leq A,\ B \leq 100

Input

Input is given from Standard Input in the following format:

A B

Output

Print the largest number among A + B, A - B, and A \times B.

Sample Input 1

-13 3

Sample Output 1

-10

The largest number among A + B = -10, A - B = -16, and A \times B = -39 is -10.

Sample Input 2

1 -33

Sample Output 2

34

The largest number among A + B = -32, A - B = 34, and A \times B = -33 is 34.

Sample Input 3

13 3

Sample Output 3

39

The largest number among A + B = 16, A - B = 10, and A \times B = 39 is 39.

Solution in C++14 (GCC 5.4.1) (judge verdict: Time Limit Exceeded)

#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("avx") 
#include<bits/stdc++.h>
using namespace std;

inline int read()
{
	int ret=0; char c=getchar();
	while(c<48||c>57)c=getchar();
	while(c>=48 && c<=57)ret=ret*10+c-48,c=getchar();
	return ret;
}
#define N 6006
int flag,vis[N],L[N],vi[N],qn,n,m,p,cnt[N],c[N][3],tot,a[N],u,v,w,C[N][2],A[N];
int q[9000009];
long long D[N];

void dfs(int p)
{
	L[p]=1;
	for(int o=A[p]; o; o=C[o][1]){
		if(L[C[o][0]])continue;
		dfs(C[o][0]);
	}
}


void df(int u){
    if(flag) return ;
    vis[u]=true;
    for(int o=a[u];o;o=c[o][1]){
        if(flag) return ;
        int v=c[o][0];
        if(!L[v])continue;
        if(D[u]+c[o][2]<D[v]){
            D[v]=D[u]+c[o][2];
            if(vis[v]){
                flag=true;
                return;
            }else{
                df(v);
            }
        }
    }
    vis[u]=false;
}
 
int main()
{
	n=read(); m=read(); p=read();
	for(int i=1;i<=m;++i){
		u=read(); v=read(); w=read();
		c[++tot][0]=v; c[tot][1]=a[u]; a[u]=tot; c[tot][2]=p-w; 
		C[tot][0]=u; C[tot][1]=A[v]; A[v]=tot; 
	} 
	
	dfs(n);
	if(!L[1]){
		puts("-1");
		return 0;
	}
	
	df(1);
	if(flag){
		puts("-1");
		return 0;
	}
	
	for(int i=1;i<=n;++i)D[i]=1e9,vi[i]=0; D[1]=0;
	
	q[qn=1]=1;
	for(int q1=1;q1<=qn;++q1){
		u=q[q1]; vi[u]=0;
		for(int o=a[u]; o; o=c[o][1]){
			v=c[o][0];
			if(!L[v])continue;
			if(D[u]+c[o][2]<D[v]){
				D[v]=D[u]+c[o][2];
				if(!vi[v]){
					
					++cnt[v];
					if(cnt[v]>n){
						puts("-1");
						return 0;
					} 
					
					q[++qn]=v;
					vi[v]=1;
				}
			}
		}
	}
	printf("%lld\n",max(0ll,-D[n]));
}