#include <bits/stdc++.h>
using namespace std;
int main() {
  int k2, k3, k5, k6;
  scanf("%d%d%d%d", &k2, &k3, &k5, &k6);
  int m1 = min(k2, min(k5, k6));
  k2 -= m1;
  int m2 = min(max(0, k2), k3);
  cout << m1 * 256 + m2 * 32 << endl;
  return 0;
}
