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