#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int i, j, k, l, max, maxx, min, sum = 0, p;
  cin >> i >> j >> k >> l;
  max = i < k ? i : k;
  maxx = max < l ? max : l;
  i = i - maxx;
  for (p = 0; p < maxx; p++) sum = sum + 256;
  min = i < j ? i : j;
  for (p = 0; p < min; p++) sum = sum + 32;
  cout << sum << "\n";
  return 0;
}
