#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n, a, b, c, d, s, x, y, z, sum = 0;
  cin >> a >> b >> c >> d;
  x = min(a, c);
  y = min(x, d);
  s = a - y;
  z = min(s, b);
  for (int i = 1; i <= y; i++) {
    sum = sum + 256;
  }
  for (int j = 1; j <= z; j++) {
    sum = sum + 32;
  }
  cout << sum << endl;
}
