#include <bits/stdc++.h>
int min(int a, int b) { return a < b ? a : b; }
using namespace std;
int main() {
  int two, three, five, six;
  cin >> two >> three >> five >> six;
  int sum = 0;
  int d = min(five, six);
  d = min(d, two);
  sum += d * 256;
  two -= d;
  sum += min(two, three) * 32;
  cout << sum;
}
