#include <bits/stdc++.h>
using namespace std;
int main() {
  int k2, k3, k5, k6;
  cin >> k2 >> k3 >> k5 >> k6;
  int p = min(k2, min(k5, k6));
  k2 -= p;
  int q = min(k2, k3);
  cout << 256 * p + 32 * q;
  return 0;
}
