#include <bits/stdc++.h>
using namespace std;
int main() {
  long long k2, k3, k5, k6;
  cin >> k2 >> k3 >> k5 >> k6;
  int a = 256, b = 32;
  long long total = 0;
  while (k2 >= 1) {
    if (k2 >= 1 && k5 >= 1 && k6 >= 1) {
      total += a;
      k2--;
      k5--;
      k6--;
    } else if (k2 >= 1 && k3 >= 1) {
      total += b;
      k2--;
      k3--;
    } else {
      break;
    }
  }
  cout << total << "\n";
  return 0;
}
