#include <bits/stdc++.h>
using namespace std;
int main() {
  int v[4];
  for (int i = 0; i < 4; i++) cin >> v[i];
  int res = 0;
  int n2, n3, n5, n6;
  n2 = n3 = n5 = n6 = 0;
  while ((v[0] > 0) && (v[2] > 0) && (v[3] > 0)) {
    res += 256;
    v[0]--;
    v[2]--;
    v[3]--;
  }
  while (v[0] > 0 && v[1] > 0) {
    res += 32;
    v[0]--;
    v[1]--;
  }
  cout << res << endl;
  return 0;
}
