#include <bits/stdc++.h>
using namespace std;
const long long MX = 2e5 + 5;
const long long INF = 1e18;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long k2, k3, k5, k6;
  cin >> k2 >> k3 >> k5 >> k6;
  long long x = min({k2, k5, k6});
  k2 -= x;
  long long y = min(k2, k3);
  cout << x * 256 + y * 32 << "\n";
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s\n";
  return 0;
}
