#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, ans, i, j, k2, k3, k5, k6;
  ans = 0;
  cin >> k2 >> k3 >> k5 >> k6;
  while (k2 >= 1 && k5 >= 1 && k6 >= 1) {
    ans += 256;
    k2--;
    k5--;
    k6--;
  }
  while (k2 >= 1 && k3 >= 1) {
    ans += 32;
    k2--;
    k3--;
  }
  cout << ans << endl;
  return 0;
}
