#include <bits/stdc++.h>
using namespace std;
long long tc, n, m, a, b, k;
string str;
char c;
set<long long> s;
map<long long, long long> mp;
int main() {
  int k2, k3, k5, k6, ans = 0;
  cin >> k2 >> k3 >> k5 >> k6;
  int x = min(k2, k5);
  x = min(x, k6);
  ans += 256 * x;
  k2 -= x;
  x = min(k2, k3);
  ans += 32 * x;
  cout << ans << '\n';
}
