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