#include <bits/stdc++.h>
using namespace std;
void swap2(int &x, int &y) {
  int z = x;
  x = y;
  y = z;
}
void sort2(int a[], int n) {
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (a[j] < a[i]) swap2(a[j], a[i]);
    }
  }
}
int main() {
  int k2, k3, k5, k6, sum = 0;
  cin >> k2 >> k3 >> k5 >> k6;
  while (k2 >= 1 && k5 >= 1 && k6 >= 1) {
    sum += 256;
    k2--;
    k5--;
    k6--;
  }
  while (k2 >= 1 && k3 >= 1) {
    sum += 32;
    k2--;
    k3--;
  }
  cout << sum;
  return 0;
}
