#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
int k2,k3,k5,k6;
//2 3 5 6
cin>>k2>>k3>>k5>>k6;
ll sum=0;
while(k2&&k5&&k6){
sum += 256;
k2--,k5--,k6--;
}
while(k2&&k3){
sum += 32;
k2--,k3--;
}
printf("%I64d",sum);
}