Start: Jul, 01, 2019 08:30:00
2019年度暑期短学期第四天
End: Jul, 01, 2019 11:30:00
Time elapsed:
Time remaining:

Problem_ID: A
Result: Accepted
Time: 75ms
Memory: 1756kB
Author: 2018212212012
In contest: 1277

#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstdlib>

using namespace std;

int main()
{
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	
	int a, b, c, d, e;
	while(cin >> a >> b >> c >> d >> e){
		int x = a - 2*e;
		int y = b - 2*e;
		int z = c - 2*e;
		int l = a - 2*d;
		int m = b - 2*d;
		int n = c - 2*d;
		
		if(d >= e){
			if(d*2 >= a||d*2 >= b||d*2 >= c){
			    cout << a*b*c - x*y*z - 2*x*e*z - 2*y*e*z - 2*x*e*y << endl;
		    }else{
		    	if(l*m*n > a*b*c - x*y*z - 2*x*e*z - 2*y*e*z - 2*x*e*y){
		    		cout << l*m*n <<endl;
				}else{
					cout << a*b*c - x*y*z - 2*x*e*z - 2*y*e*z - 2*x*e*y << endl;
				}
			}
		}else{
			cout << a*b*c - 2*x*d*z - 2*y*d*z - 2*x*d*y <<endl;
		}
	}
	
	return 0;
}