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