#include <bits/stdc++.h>
int main() {
  long long int k2, k3, k5, k6, res1 = 0, res2 = 0, i;
  scanf("%lld %lld %lld %lld", &k2, &k3, &k5, &k6);
  if (k2 != 0 && k5 != 0 && k6 != 0) {
    while (1) {
      if (k2 != 0 && k5 != 0 && k6 != 0) {
        res1 = res1 + 256;
        k2--;
        k5--;
        k6--;
      } else
        break;
    }
  }
  if (k2 != 0 && k3 != 0) {
    while (1) {
      if (k2 != 0 && k3 != 0) {
        res2 = res2 + 32;
        k2--;
        k3--;
      } else
        break;
    }
  }
  printf("%lld", res1 + res2);
}
