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