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