#include <bits/stdc++.h>
using namespace std;
template <typename T>
T In() {
  T x;
  cin >> x;
  return x;
}
string shorter(string S, string T) { return S.size() <= T.size() ? S : T; }
int main() {
  ios::sync_with_stdio(false), cin.tie(nullptr);
  int k2 = In<int>(), k3 = In<int>(), k5 = In<int>(), k6 = In<int>(),
      b = min(k2, min(k5, k6));
  cout << b * 256 + min(k2 - b, k3) * 32;
  return cout << endl, 0;
}
