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