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