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