#include <bits/stdc++.h>
long long ara[5];
int main() {
  long long i, min = 10000000;
  long long total = 0;
  for (i = 0; i < 4; i++) {
    scanf("%I64d", &ara[i]);
    if (i == 1) continue;
    if (ara[i] < min) min = ara[i];
  }
  ara[0] -= min;
  total = 256 * min;
  if (ara[0] < ara[1])
    min = ara[0];
  else
    min = ara[1];
  total += 32 * min;
  printf("%I64d\n", total);
  return 0;
}
