#include <bits/stdc++.h>
using namespace std;
int main() {
  int k2, k3, k5, k6;
  int sum256 = 0, sum32 = 0;
  cin >> k2 >> k3 >> k5 >> k6;
  while (k5 != 0 and k6 != 0 and k2 != 0) {
    k2 = k2 - 1;
    k5 = k5 - 1;
    k6 = k6 - 1;
    sum256 = sum256 + 256;
  }
  while ((k3 != 0) and (k2 != 0)) {
    k2 = k2 - 1;
    k3 = k3 - 1;
    sum32 = sum32 + 32;
  }
  cout << sum32 + sum256;
  return 0;
}
