#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, c, d;
  cin >> a >> b >> c >> d;
  long long p = (min(c, d));
  long long r = (min(a, p));
  a = a - p;
  if (a < 0) a = 0;
  long long q = min(a, b);
  long long sum = (r * 256) + (q * 32);
  cout << sum << endl;
  return 0;
}
