#include <bits/stdc++.h>
int main(void) {
  int k2, k3, k5, k6;
  int k32, k256;
  long long sum = 0;
  scanf("%d %d %d %d", &k2, &k3, &k5, &k6);
  if (k6 < k5) k5 = k6;
  k256 = k5;
  if (k2 < k5) k256 = k2;
  sum = (long long)256 * k256;
  k2 = k2 - k256;
  if (k3 < k2) k2 = k3;
  sum += (long long)32 * k2;
  printf("%lld\n", sum);
  return 0;
}
