#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a2, b3, c5, d6, sum, min;
  scanf("%lld %lld %lld %lld", &a2, &b3, &c5, &d6);
  sum = 0;
  min = (a2 < (c5 < d6 ? c5 : d6) ? a2 : (c5 < d6 ? c5 : d6));
  sum = sum + (256 * min);
  a2 = a2 - min;
  min = (a2 < b3 ? a2 : b3);
  sum = sum + (32 * min);
  printf("%lld\n", sum);
  return 0;
}
