#include <bits/stdc++.h>
using namespace std;
int min(int a, int b, int c) {
  int min = a;
  if (b < min) min = b;
  if (c < min) min = c;
  return min;
}
int min(int a, int b) {
  if (a < b)
    return a;
  else
    return b;
}
int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int sum;
  int n = min(a, c, d);
  a = a - n;
  sum = 256 * n + min(a, b) * 32;
  cout << sum << endl;
  return 0;
}
