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