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