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