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