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