#include <bits/stdc++.h>
int minimm(int a, int b) {
  if (a < b) {
    return a;
  }
  if (b < a) return b;
  if (a == b) return a;
}
int find_min(int a, int b, int c) {
  if (a < b && a < c) {
    return a;
  } else if (b < a && b < c) {
    return b;
  } else if (c < a && c < b) {
    return c;
  }
  if (a == b && a == c) return a;
}
int main() {
  int k2, k3, k5, k6, n256, n32, i, sum = 0;
  scanf("%d %d %d %d", &k2, &k3, &k5, &k6);
  int min = find_min(k2, k5, k6);
  k2 -= min;
  sum = 256 * min;
  if (k2 == 0) {
    printf("%d\n", sum);
    return 0;
  }
  n32 = minimm(k2, k3);
  while (n32--) {
    sum += 32;
  }
  printf("%d\n", sum);
  return 0;
}
