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