#include <bits/stdc++.h>
using namespace std;
int main() {
  int k2, k3, k5, k6;
  cin >> k2 >> k3 >> k5 >> k6;
  int j = 0, i = 0;
  if (k6 > 0 && k5 > 0 && k2 > 0) {
    if (k6 <= k5 && k6 <= k2) {
      j = k6;
    } else if (k5 <= k2 && k5 <= k6)
      j = k5;
    else if (k2 <= k5 && k2 <= k6)
      j = k2;
  }
  int one = 256 * j;
  k2 = k2 - j;
  if (k3 > 0 && k2 > 0) {
    if (k3 > k2) i = k2;
    if (k2 >= k3) i = k3;
  }
  int two = 32 * i;
  cout << one + two;
  return 0;
}
