#include <bits/stdc++.h>
using namespace std;
int main() {
  long long two, three, five, six;
  cin >> two >> three >> five >> six;
  long long ans;
  long long mn = min(two, min(five, six));
  ans = 256 * mn;
  two = two - mn;
  mn = min(two, three);
  ans += 32 * mn;
  cout << ans << endl;
}
