#include <bits/stdc++.h>
using namespace std;
int main() {
  int n2, n3, n5, n6;
  cin >> n2 >> n3 >> n5 >> n6;
  int n;
  n = min(n2, min(n5, n6));
  n2 -= n;
  int m;
  m = min(n2, n3);
  cout << ((m * 32) + (n * 256));
}
