#include #define _USE_MATH_DEFINES using namespace std; #define li long long int #define rep(i,to) for(li i=0;i<((li)(to));i++) #define repp(i,start,to) for(li i=(li)(start);i<((li)(to));i++) #define pb push_back #define sz(v) ((li)(v).size()) #define bgn(v) ((v).begin()) #define eend(v) ((v).end()) #define allof(v) (v).begin(), (v).end() #define dodp(v,n) memset(v,(li)n,sizeof(v)) #define bit(n) (1ll<<(li)(n)) #define mp(a,b) make_pair(a,b) #define rin rep(i,n) #define rjm rep(j,m) #define DBGP 0 #define idp if(DBGP) #define F first #define S second #define p2(a,b) idp cout<F<<" , "<<(it)->S<<"] ";}puts("");} #define EPS 1e-10 #define ETOL 1e-8 #define MOD 100000009 typedef pair PI; li v[4]; li cnt(li a, li b, li c){ li res=0; li vv[4]; rep(i,4)vv[i]=v[i]; rep(i,4){ res+=vv[i]/c; vv[i]=vv[i]%c; res+=vv[i]/b; vv[i]=vv[i]%b; res+=vv[i]/a; vv[i]=vv[i]%a; if(vv[i]>0)return -1; } return res; } int main(int argc, char *argv[]){ rep(i,4)cin>>v[i]; li res=100000000000000; repp(a,1,31){ repp(b,a+1, 31){ repp(c, b+1, 31){ li tres=cnt(a,b,c); if(tres>=0 && tres