#include <bits/stdc++.h>
using namespace std;
long long int mini(long long int p, long long int q) {
  if (p < q) return p;
  return q;
}
int main() {
  long long int k2, k3, k5, k6, total = 0;
  cin >> k2 >> k3 >> k5 >> k6;
  int m = 0;
  m = mini(k2, k5);
  m = mini(m, k6);
  total = m * 256;
  m = mini(k2 - m, k3);
  total += m * 32;
  cout << total << endl;
}
