#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  long long a2, a3, a5, a6, sum = 0;
  cin >> a2 >> a3 >> a5 >> a6;
  long long k = min(a2, min(a5, a6));
  sum += k * 256;
  sum += min((a2 - k), a3) * 32;
  cout << sum << endl;
  return 0;
}
