#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n;
  cin >> n;
  long long int a[8], pages[8];
  a[0] = 0;
  for (int i = 1; i < 8; ++i) {
    cin >> pages[i];
    a[i] = a[i - 1] + pages[i];
  }
  long long int ans = n % a[7];
  if (ans == 0) {
    for (int i = 7; i > 0; --i) {
      if (pages[i] != 0) {
        cout << i;
        return 0;
      }
    }
  }
  for (int i = 0; i < 8; ++i) {
    if (ans <= a[i]) {
      cout << i;
      break;
    }
  }
  return 0;
}
