#include <bits/stdc++.h>
int main() {
  int k2, k3, k5, k6;
  std::cin >> k2 >> k3 >> k5 >> k6;
  int sum = 0;
  while (k2 > 0 && k5 > 0 && k6 > 0) {
    sum += 256;
    k2 -= 1;
    k5 -= 1;
    k6 -= 1;
  }
  while (k3 > 0 && k2 > 0) {
    sum += 32;
    k3 -= 1;
    k2 -= 1;
  }
  std::cout << sum;
}
