#include <bits/stdc++.h>
using namespace std;
int main() {
  long long k2, k3, k5, k6;
  cin >> k2 >> k3 >> k5 >> k6;
  long long ans = 0, no;
  no = min(k2, min(k5, k6));
  ans = no * 256;
  k2 -= no;
  no = min(k2, k3);
  ans += no * 32;
  printf("%lld\n", ans);
  return 0;
}
