#include #include #include using namespace std; using ll = long long; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); vector use(4); for(int i = 0;i<4;i++) cin>>use[i]; int mx = 0; int ans = 1e8; for(int i = 0;i<4;i++) mx = max(mx,use[i]); for(int i = 1;i<=mx;i++){ for(int j = i ;j<=mx;j++){ for(int k = j;k<=mx;k++){ vector dp(mx+1,1e8); dp[0] = 0; for(int l = 1;l<=mx;l++){ if(l-i>=0) dp[l] = min(dp[l],dp[l-i]+1); if(l-j>=0) dp[l] = min(dp[l],dp[l-j]+1); if(l-k>=0) dp[l] = min(dp[l],dp[l-k]+1); } int cnt = 0; for(int l = 0;l<4;l++) cnt += dp[use[l]]; ans = min(ans,cnt); } } } cout<