#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int count = 0;
  int loop;
  loop = max(a, max(b, max(c, d)));
  for (int i = 1; i <= loop; i++) {
    if (a >= 1 && c >= 1 && d >= 1) {
      count += 256;
      a--;
      c--;
      d--;
    }
    if ((b != 0 && a != 0) && (a < 1 || c < 1 || d < 1)) {
      count += 32;
      b--;
      a--;
    }
  }
  cout << count << endl;
  return 0;
}
