#include <bits/stdc++.h>
using namespace std;
int main() {
  long long ans = 0;
  long long k2, k3, k5, k6;
  scanf("%lld", &k2);
  ;
  scanf("%lld", &k3);
  ;
  scanf("%lld", &k5);
  ;
  scanf("%lld", &k6);
  ;
  long long minn = min(k2, (min(k5, k6)));
  ans += minn * 256;
  k2 -= minn;
  k5 -= minn;
  k6 -= minn;
  long long minn2 = min(k2, k3);
  ans += minn2 * 32;
  printf("%lld\n", ans);
  ;
  return 0;
}
