#include <bits/stdc++.h>
using namespace std;
int main() {
  int k2, k3, k5, k6, k256, k32;
  int sum = 0;
  cin >> k2 >> k3 >> k5 >> k6;
  k256 = ((k2 < k5) ? ((k2 < k6) ? k2 : k6) : ((k5 < k6) ? k5 : k6));
  k2 = k2 - k256;
  k32 = ((k2 < 0) ? 0 : ((k2 < k3) ? k2 : k3));
  sum = k256 * 256 + k32 * 32;
  cout << sum;
  return 0;
}
