#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, t, s = 0, k;
  cin >> a >> b >> c >> d;
  t = min(a, min(c, d));
  for (int i = 0; i < t; i++) {
    s = s + 256;
  }
  if (a != t) {
    k = min(a - t, b);
    while (k--) {
      s = s + 32;
    }
  }
  cout << s;
  return 0;
}
