#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, a, b, c;
  cin >> n >> a >> b >> c;
  if (n % 4 != 0) {
    int num = n % 4;
    switch (num) {
      case 3:
        cout << min(a, min(b + c, 3 * c)) << endl;
        break;
      case 2:
        cout << min(b, min(a * 2, 2 * c)) << endl;
        break;
      case 1:
        cout << min(c, min(a * 3, a + b)) << endl;
        break;
    }
  } else {
    cout << 0 << endl;
  }
  return 0;
}
