#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b, c, d, s, ans;
  cin >> a >> b >> c >> d;
  s = min(a, min(c, d));
  a = a - s;
  c = c - s;
  d = d - s;
  ans = s * 256;
  s = min(a, b);
  ans += s * 32;
  cout << ans << "\n";
  return 0;
}
