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