abcd分別代表 1x1 2x2 3x3 4x4
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c,d,box,count;
while(std::cin >> a >> b >> c >> d){
count=0;
count+=d;
for (int i = 0; i < c; i++) {
count++;
box = 64;
box-=27;
while(a>0){
if(a>0 && box>0){
a--;
box--;
}else break;
}
}
b*=8;
if(b>64)count+=b/64;
b=b%64;
box=64;
box-=b;
if(a<=0){
if(box!=64)count++;
std::cout << count << std::endl;
}
else if(a>0){
a-=box;
count++;
if(a>0){
count+=(a/64);
if(a%64>0)count++;
std::cout << count << std::endl;
}
else std::cout << count << std::endl;
}
}
return 0;
}