#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int k2, k3, k5, k6, mi;
  long long int a, b;
  cin >> k2 >> k3 >> k5 >> k6;
  mi = min(k2, min(k5, k6));
  a = 256 * mi;
  k2 = k2 - mi;
  mi = min(k2, k3);
  b = 32 * mi;
  cout << a + b;
}
