#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int a, b, c, d, x, result = 0;
  cin >> a >> b >> c >> d;
  x = min(a, min(c, d));
  result += x * 256;
  a -= x;
  result += min(a, b) * 32;
  cout << result;
  return 0;
}
