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