#include <bits/stdc++.h>
using namespace std;
int main() {
  int k2, k3, k5, k6;
  cin >> k2 >> k3 >> k5 >> k6;
  int n = min(k2, k5);
  n = min(n, k6);
  int ans = 0;
  ans += 256 * n;
  k2 -= n;
  k5 -= n;
  k6 -= n;
  n = min(k2, k3);
  ans += 32 * n;
  cout << ans;
  return 0;
}
