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