using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace capp
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), x => int.Parse(x));
            int i = 0;
            while (n > 0)
            {
                n -= a[i];
                i++;
                if (i == 7)
                    i = 0;
            }
            Console.WriteLine(i == 0 ? 7 : i);

        }
    }

}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace taskA
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] days = new int[7];
            string[] s = Console.ReadLine().Split(' ');
            for (int i = 0; i < 7; i++)
            {
                days[i] = int.Parse(s[i]);
            }
            try
            {
                while (n > 0)
                {
                    for (int i = 0; i < 7; i++)
                    {
                        n -= days[i];
                        if (n <= 0) throw new Exception((i+1).ToString());
                    }
                }
            }
            catch(Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
    }
}

using System;
using System.Linq;

namespace CSharp
{
    public class _139A
    {
        public static void Main()
        {
            int n = int.Parse(Console.ReadLine()) - 1;
            int[] w = Console.ReadLine().Split().Select(token => int.Parse(token)).ToArray();

            n %= w.Sum();

            for (int i = 0; i < 7; i++)
            {
                if (n < w[i])
                {
                    Console.WriteLine(i + 1);
                    return;
                }

                n -= w[i];
            }
        }
    }
}

using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;

namespace Codeforces
{
    internal class Program
    {
        private static void Main()
        {
            if (Debugger.IsAttached)
            {
                Console.SetIn(new StreamReader(@"..\..\..\..\Tests\A2.in"));
            }

            Solve();

            if (Debugger.IsAttached)
            {
                Console.In.Close();
                Console.SetIn(new StreamReader(Console.OpenStandardInput()));
                Console.ReadLine();
            }
        }

        private static void Solve()
        {
            var n = ReadInt();
            var days = ReadIntArray();
            var day = 0;
            while (n > 0)
            {
                day %= 7;
                n -= days[day++];
            }
            Console.WriteLine(day);
        }

        #region Reader

        private static string Read()
        {
            return Console.ReadLine();
        }

        private static string[] ReadArray()
        {
            return Console.ReadLine().Split(' ');
        }

        private static int[] ReadIntArray()
        {
            var input = Console.ReadLine().Split(' ').Select(Int32.Parse).ToArray();
            return input;
        }

        private static int ReadInt()
        {
            return Int32.Parse(Console.ReadLine());
        }

        private static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }

        private static int ReadNextInt(string[] input, int index)
        {
            return Int32.Parse(input[index]);
        }

        #endregion
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int hojas;
            int[] diasSemana = new int[7];
        hojas = int.Parse(Console.ReadLine());
        string s1 = Console.ReadLine();
        int[] a = new int[7];
        string[] s = s1.Split(' ');
        for(int i =0; i<7; i++)
            diasSemana[i] = int.Parse(s[i]);
        int dia=0;
        while(hojas>0)
        {
            hojas-=diasSemana[dia];
                if(hojas<=0)
                {
                       Console.WriteLine(dia+1);
                       break;
                }
            if(dia==6 )
            {
                dia=0;
                continue;
            }
            dia++;
        }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int pagesTotal = int.Parse(Console.ReadLine());
            int[] pagesPerDay = Array.ConvertAll(Console.ReadLine().Split(' '), x => int.Parse(x));

            int currentDay = 0;
            while (pagesTotal > 0)
            {
                currentDay++;
                if (currentDay == 8)
                    currentDay = 1;

                pagesTotal -= pagesPerDay[currentDay - 1];
            }

            Console.WriteLine(currentDay);
            Console.Read();
        }
    }
}

using System;
class Program
    {
        public static void Main(string[] args)
        {
            int[] data;
            {
                string[] input = Console.In.ReadToEnd().Split(new char[] { '\t', ' ', '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
                data = new int[input.Length + 1];
                data[0] = int.Parse(input[0]);
                for (int i = 1; i < input.Length; ++i)
                    data[data.Length - 1] += data[i] = int.Parse(input[i]);
            }
            data[data.Length - 1] = data[0] % data[data.Length - 1];
            if (data[data.Length - 1] == 0)
            {
                int i = data.Length - 2;
                while (i > 1 && data[i] == 0) --i;
                Console.WriteLine(i);
            }
            else
            {
                for (int i = 1, lim = data.Length - 1; i < lim; ++i)
                {
                    if (data[lim] <= data[i]) { Console.WriteLine(i); break; }
                    else data[lim] -= data[i];
                }
            }
        }
    }

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApp1
{
    internal class Program
    {

        private static void Main(string[] args)
        {
            string input = Console.ReadLine();
            int n = int.Parse(input);

            var daysReading = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();
            var pagesPerWeek = daysReading.Sum();
            int rem = n % pagesPerWeek;
            if (rem == 0)
                rem = pagesPerWeek;
            for(int i = 1;i<=7;i++)
            {
                rem -= daysReading[i - 1];
                if(rem<=0)
                {
                    Console.WriteLine(i);
                 //     Console.ReadKey();
                    return;
                }

            }

          // Console.WriteLine(count);
         //  Console.ReadKey();
        }

        // Console.ReadKey();

    }

}

using System;
class MyBuild
{
    static void Main()
    {
        int pagesread = 0, i = 0;
        int n = int.Parse(Console.ReadLine());
        string input = Console.ReadLine();

        string[] strppd = input.Split(' ');
        int[] pageperday = Array.ConvertAll(strppd, int.Parse);

        while (pagesread < n)
        {
            if (i == 7)
            {
                i = 0;
            }
            pagesread += pageperday[i];
            i++;

        }
        Console.WriteLine(i);
    }
}

using System;

    class Program {
        static void Main(string[] args) {

            int pages = Int32.Parse(Console.ReadLine());
            string[] dayValues = Console.ReadLine().Split(' ');
            int currentPages = 0;
            int currentDay = 0;

            while (true) {

                if (currentDay == 7) {
                    currentDay = 0;
                }

                currentPages += Int32.Parse(dayValues[currentDay]);

                if (currentPages >= pages) {
                    Console.WriteLine(currentDay + 1);
                    break;
                } else {
                    currentDay++;
                }
            }
        }
    }

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication17
{
    class Program
    {
        static void Main(string[] args)
        {
            var pages = int.Parse(Console.ReadLine());
            var init = Console.ReadLine().Split(' ');
            Dictionary<int, int> week = new Dictionary<int, int>();
            int day = 1;

            for (int i = 0; i < init.Length; i++)
            {
                week.Add(day, int.Parse(init[i]));
                day++;
            }

            while (pages > 0)
            {
                if (day == 8)
                    day = 1;
                pages -= week[day];
                day++;
            }

            Console.WriteLine(day - 1);
            Console.ReadLine();

        }
    }
}

using System;
using System.Linq;
class Demo
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine()), i = 6;
        var a = Console.ReadLine().Split().Select(int.Parse).ToArray();
        do
        {
            i += (i == 6 ? -6 : 1);
            n -= a[i];
        } while (n > 0);
        Console.WriteLine(i + 1);
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication97
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            string[] z = new string[7];
            z= s.Split(' ');
            byte d=0;
            do
            {
                if (d == 7) { d = 1; }
                else { d++; }
                n -= int.Parse(z[d - 1]);
            }
            while (n > 0);
            Console.WriteLine(d);
        }
    }
}

using System; using System.Linq;

class P {
  static void Main() {
    var n = int.Parse(Console.ReadLine());
    var d = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
    n = (n-1) % d.Sum()+1;
    for (var i = 0 ; ; i++)
      if (n <= d[i]) { Console.WriteLine(i + 1); return; }
      else n -= d[i];
  }
}

using System;
using System.IO;
using System.Linq;
using System.Text;

namespace Petr_and_Book
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            int n = Next();

            var nn = new int[7];
            for (int i = 0; i < nn.Length; i++)
            {
                nn[i] = Next();
            }

            int sum = nn.Sum();
            while (n > sum)
            {
                n -= sum;
            }

            for (int i = 0; i < nn.Length; i++)
            {
                n -= nn[i];
                if (n <= 0)
                {
                    writer.WriteLine(i + 1);
                    break;
                }
            }
            writer.Flush();
        }

        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
    }
}

using System;
using System.Text;

namespace vvv
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            var t = Console.ReadLine().Split(' ');

            int[] a = new int[7];

            for (int i = 0; i < 7; i++)
            {
                a[i] = int.Parse(t[i]);
            }

            while (true)
            {
                for (int i = 0; i < 7; i++)
                {
                    n -= a[i];

                    if (n <= 0)
                    {
                        Console.WriteLine(i + 1);
                        Environment.Exit(0);
                    }
                }
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using System.IO;
using System.Numerics;
using System.Globalization;
using System.Threading;

namespace probleme {
    class Program {
        static void Main(string[] args) {
            //Console.SetIn(new StreamReader("file.txt"));
            int n = int.Parse(Console.ReadLine());
            int[] w = Array.ConvertAll(Console.ReadLine().Split(' '), tz => int.Parse(tz));
            int s = w.Sum();
            n %= s;
            if (n == 0) {
                for (int i = 6; i >= 0; i--) {
                    if (w[i] != 0) {
                        Console.Write(i + 1);
                        break;
                    }
                }
            } else {
                for (int i = 0; i <= 6; i++) {
                    if (n <= w[i]) {
                        Console.Write(i + 1);
                        break;
                    } else {
                        n -= w[i];
                    }
                }
            }
            //Console.ReadKey();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace task39A
{
    class Program
    {
        static void Main(string[] args)
        {
            var count = Convert.ToInt32(Console.ReadLine());
            string[] arr = Console.ReadLine().Split(' ');
            int[] days = new int[arr.Length];
            for (int i = 0; i < arr.Length; i++)
            {
                days[i] = Convert.ToInt32(arr[i]);
            }
            int index = 0;
            var result = -1;
            while (count > 0)
            {
                count -= days[index % days.Length];
                result = index % days.Length;
                index++;
            }
            Console.WriteLine(result + 1);
            //Console.ReadLine();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int iCountPage = Convert.ToInt32(Console.ReadLine());
            int[] data = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);

            int i = -1;
            while (iCountPage > 0)
            {
                i++;
                if (i == data.Length)
                    i = 0;
                iCountPage -= data[i];

            }

            Console.WriteLine(i+1);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace S.A.M
{
    class Program
    {
        static void Main(string[] args)
        {
            int pag;
            int[] diasSemana = new int[7];
            pag = int.Parse(Console.ReadLine());
            string s1 = Console.ReadLine();
            int[] a = new int[7];
            string[] s = s1.Split(' ');
            for (int i = 0; i < 7; i++)
            {
                diasSemana[i] = int.Parse(s[i]);
            }
            int dia = 0;
            while (pag > 0)
            {
                pag -= diasSemana[dia];
                if (pag <= 0)
                {
                    Console.WriteLine(dia + 1); break;
                }
                if (dia == 6)
                {
                    dia = 0;
                    continue;
                }
                dia++;
            }
        }
    }
}

using System;
using System.Linq;
using System.Collections.Generic;

public class App1
{
    public static void Main()
    {
        Func<string> read = ()=>Console.ReadLine();
        Action<object> write = _=>Console.WriteLine(_.ToString());

        var n=read().ToInt();
        var a=read().ToIntA();
        while(true)
        for(var i=0;i<a.Length;i++)
        {
            n-=a[i];
            if(n<=0)
            {
                write(i+1);
                return;
            }
        }
    }
}

static class Exts
{
    public static int ToInt(this string s)
    {
        return int.Parse(s);
    }

    public static int[] ToIntA(this string s)
    {
        return s.Split(" ").Select(ToInt).ToArray();
    }

    public static long ToLong(this string s)
    {
        return long.Parse(s);
    }

    public static string[] Split(this string s,string sp)
    {
        return s.Split(new[]{sp},StringSplitOptions.RemoveEmptyEntries);
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace book
{
    class Program
    {
        static void Main(string[] args)
        {
            try {
                int sayfasayi = int.Parse(Console.ReadLine());
                string gunler = Console.ReadLine();
                hesapla(sayfasayi, gunler);
                Console.ReadKey();
            }
            catch { }
        }
      static void hesapla(int sayi,string gunler_)
        {
            int[] sayilar = new int[7];
            int sayac = 0;
            int toplam = 0;
            foreach (string str in gunler_.Split(' '))
            {
                sayilar[sayac] = int.Parse(str);
                sayac++;
            }
            sayac = 0;
            toplam = sayilar[0];
            while (toplam < sayi)
            {
                if (sayac != sayilar.Length-1)
                {
                    if (toplam < sayi)
                    {
                        toplam += sayilar[sayac + 1];
                    }
                    sayac++;
                }
                else
                {
                    sayac = 0;
                    toplam += sayilar[sayac];
                }

            }
            Console.WriteLine(sayac+1);
        }
    }
}

using System;
namespace Contest
{
class MainClass{
   public static void Main (string[] args){
        long n,s=0;
        long []m;
        m=new long[7];
        n=long.Parse(Console.ReadLine());

        string[] num = Console.ReadLine().Split(' ');
        for(long i=0;i<7;i++)
        {
            m[i]=long.Parse(num[i]);
        }
        while (n>0)
        {
            s=s%7;
            n-=m[s];
            s++;
        }
            Console.WriteLine(s);
    }
}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CR_111_A
{
    class Program
    {

        static void Main()
        {
            //int k = int.Parse(Console.ReadLine());
            //string[] tmp = Console.ReadLine().Split(' ');
            int k = int.Parse(Console.ReadLine());
            string[] tmp = Console.ReadLine().Split(' ');
            int[] str = new int[7];
            for (int i = 0; i < 7; i++)
                str[i] = int.Parse(tmp[i]);
            int sum = 0 , j = 0;
            while (sum < k)
            {
                if (j == 7)
                    j = 0;
                sum += str[j];
                j++;

            }
            Console.WriteLine(j);

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace aaaa
{
    class Program
    {
        static void Main(string[] args)
        {
            long k = long.Parse(Console.ReadLine());

            string[] s = Console.ReadLine().Split(' ');

            int[] a = new int[s.Length];

            for (int i = 0; i < s.Length; i++)
            {
                a[i] = int.Parse(s[i]);
            }

            int j = 0;
            while (k > 0)
            {
                j++;
                if (j > a.Length)
                {
                    j = 1;
                }
                k = k - a[j-1];

            }

            Console.WriteLine(j);
        }
    }
}

using System;
using System.Collections.Generic;
using System.IO;

namespace prA {

    class Program {
#if ONLINE_JUDGE
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);
#else
        private static readonly StreamWriter writer = new StreamWriter("output");
        private static readonly StreamReader reader = new StreamReader("input");
#endif
        static void Main(string[] args) {
            int n = Next();
            int[] s = new int[7];
            for(int i = 0; i < 7; i++) {
                s[i] = Next();
            }
            int d = 0;
            while(n - s[d] > 0) {
                n -= s[d];
                d++;
                d %= 7;
            }
            writer.Write(d + 1);
            writer.Flush();
#if !ONLINE_JUDGE
            writer.Close();
#endif
        }
        private static int Next() {
            int c;
            int res = 0;
            do {
                c = reader.Read();
                if(c == -1)
                    return res;
            } while(c != '-' && (c < '0' || c > '9'));
            int sign = 1;
            if(c == '-') {
                sign = -1;
                c = reader.Read();
            }
            res = c - '0';
            while(true) {
                c = reader.Read();
                if(c < '0' || c > '9')
                    return res * sign;
                res *= 10;
                res += c - '0';
            }
        }
    }
}

using System;
using System.Linq;
using System.Text.RegularExpressions;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = Int32.Parse(Console.ReadLine());
            int[] Days = Console.ReadLine().Split().Select(x => Convert.ToInt32(x)).ToArray();
            int Sum = 0;
            int i;

            while (true)
            {
                for (i = 1; i <= 7; i++)
                {
                    Sum += Days[i-1];
                    if (Sum >= N)
                        break;
                }
                if (Sum >= N)
                    break;
            }

            Console.WriteLine(i);
            Console.ReadLine();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    public class Program
    {
        public static void Main()
        {
            int[] parameters;
            int pages, incr;

            pages = Convert.ToInt32(Console.ReadLine());
            parameters = Console.ReadLine().Split(' ').Select(n => Convert.ToInt32(n)).ToArray();

            for (incr = 0; incr < 7; ++incr)
            {
                pages -= parameters[incr];
                if (pages <= 0)
                    break;

                if (incr == 6)
                    incr = -1;
            }

            Console.WriteLine(++incr);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
public class Codeforces
{
    #region Main
    protected static TextReader reader;
    protected static TextWriter writer;
    static void Main()
    {
        reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);
        writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);
        var n = ReadInt();
        var p = ReadIntArray();
        var i = 0;
        for (i = 0; ; i++)
        {
            n -= p[i % 7];
            if (n <= 0)
            {
                break;
            }
        }
        writer.WriteLine(i % 7 + 1);
        reader.Close();
        writer.Close();
    }
    #endregion
    #region Read / Write

    private static Queue<string> currentLineTokens = new Queue<string>();

    private static string[] ReadAndSplitLine()
    {
        return reader.ReadLine().Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public static string ReadToken()
    {
        while (currentLineTokens.Count == 0)
            currentLineTokens = new Queue<string>(ReadAndSplitLine());
        return currentLineTokens.Dequeue();
    }

    public static int ReadInt()
    {
        return int.Parse(ReadToken());
    }

    public static long ReadLong()
    {
        return long.Parse(ReadToken());
    }

    public static double ReadDouble()
    {
        return double.Parse(ReadToken(), CultureInfo.InvariantCulture);
    }

    public static int[] ReadIntArray()
    {
        return ReadAndSplitLine().Select(int.Parse).ToArray();
    }

    public static long[] ReadLongArray()
    {
        return ReadAndSplitLine().Select(long.Parse).ToArray();
    }

    public static double[] ReadDoubleArray()
    {
        return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();
    }
    public static int[][] ReadIntMatrix(int numberOfRows)
    {
        int[][] matrix = new int[numberOfRows][];
        for (int i = 0; i < numberOfRows; i++)
            matrix[i] = ReadIntArray();
        return matrix;
    }
    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows);
        int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++)
        {
            ret[i] = new int[numberOfRows];
            for (int j = 0; j < numberOfRows; j++)
                ret[i][j] = matrix[j][i];
        }
        return ret;
    }

    public static string[] ReadLines(int quantity)
    {
        string[] lines = new string[quantity];
        for (int i = 0; i < quantity; i++)
            lines[i] = reader.ReadLine().Trim();
        return lines;
    }
    public static void WriteArray<T>(IEnumerable<T> array)
    {
        writer.WriteLine(string.Join(" ", array));
    }

    public static void Write<T>(params T[] array)
    {
        WriteArray(array);
    }

    public static void WriteLines<T>(IEnumerable<T> array)
    {
        foreach (var a in array)
            writer.WriteLine(a);
    }
    private static int Next()
    {
        int c;
        int res = 0;
        do
        {
            c = reader.Read();
            if (c == -1)
                return res;
        } while (c != '-' && (c < '0' || c > '9'));
        int sign = 1;
        if (c == '-')
        {
            sign = -1;
            c = reader.Read();
        }
        res = c - '0';
        while (true)
        {
            c = reader.Read();
            if (c < '0' || c > '9')
                return res * sign;
            res *= 10;
            res += c - '0';
        }
    }
    #endregion
}

using System;

namespace AllProblems
{
    class Program
    {
        static void Main(string[] args)
        {
            _139A_PetrAndBook.Run();

        }
    }
    class _139A_PetrAndBook
    {
        public static void Run()
        {
            var n = short.Parse(Console.ReadLine().Trim());
            var l = Console.ReadLine().Trim().Split(' ');

            var arr = new short[7];
            for (var i = 0; i < 7; i++)
                arr[i] = short.Parse(l[i]);

            while (n > 0)
            {
                for (var i = 0; i < 7; i++)
                {
                    n -= arr[i];
                    if (n > 0) continue;
                    Console.WriteLine((i+1));
                    Console.ReadLine();
                    return;
                }
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Petr_and_Book___Codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string line = Console.ReadLine();

            int[] arr = line.Split(' ').Select(x => int.Parse(x)).ToArray();
            int readpages = 0;
            int i = 1;

            while (readpages!= n)
            {

                readpages = readpages + arr[i - 1];
                if (readpages >= n)
                {
                    break;
                }

                i++;

                if (i > 7)
                {
                    i = 1;
                }

            }

            Console.WriteLine(i);

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;

namespace codeforces
{
	class Program
	{
		public class User
		{
			public int c;

			public int r;
		}

		public class Point
		{
			public int x;

			public int y;
		}

		public class Comparer : IComparer<User>
		{
			public int Compare(User x, User y)
			{
				if (x.c < y.c || (x.c == y.c && x.r < y.r))
					return -1;
				return 1;
			}
		}

		public static long getGcd(long a, long b)
		{
			if (b == 0)
				return a;
			return getGcd(b, a % b);
		}

		public static void WriteYESNO(bool x, string yes = "YES", string no = "NO")
		{
			if (x)
				Console.WriteLine(yes);
			else
			{
				Console.WriteLine(no);
			}
		}

		public static string getString()
		{
			return Console.ReadLine();
		}

		public static List<int> getList()
		{
			var s = Console.ReadLine();
			return s.Split(' ').Select(int.Parse).ToList();
		}

		public static List<long> getLongList()
		{
			var s = Console.ReadLine();
			return s.Split(' ').Select(long.Parse).ToList();
		}

		public static int Min(int x, int y)
		{
			return Math.Min(x, y);
		}

		public static int Max(int x, int y)
		{
			return Math.Max(x, y);
		}

		public static int Abs(int x)
		{
			return Math.Abs(x);
		}

		public static int getInt()
		{
			var s = Console.ReadLine();
			return int.Parse(s);
		}

		public static long getLong()
		{
			var s = Console.ReadLine();
			return long.Parse(s);
		}

		public static bool Equal(int x, int y, int x1, int y1)
		{
			return x == x1 && y == y1;
		}

		public class Vertex
		{
			public List<int> edges;

			public int ct;

			public bool was;
		}

		private static void Main(string[] args)
		{
/*			var input = new StreamReader("input.txt");
			var output = new StreamWriter("output.txt");*/
			var n = getInt();
			var l = getList();
			var ct = 0;
			var cur = 0;
			while (ct + l[cur] < n)
			{
				ct += l[cur];
				cur = (cur + 1) % 7;
			}
			Console.WriteLine(cur + 1);
			Console.ReadLine();
		}
	}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] y = Console.ReadLine().Split(' ');
            int[] a = new int[7];
            for (int i = 0; i < a.Length; i++)
            {
                a[i] = int.Parse(y[i]);
            }
            int nn = 0;
            while (n > 0)
            {
                 if (nn == 7)
                    nn = 0;
                n -= a[nn];
                nn++;

            }
            Console.Write(nn);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] str = Console.ReadLine().Split(' ');
            int[] days = new int[str.Length];
            for (int i = 0; i < str.Length; i++)
                days[i] = int.Parse(str[i]);
            int op = 0;
            int len = 0;
            while (len < n)
            {
                op = op % 7;
                len += days[op];
                op++;
            }
            op--;
            Console.WriteLine((op + 1).ToString());
        }
    }
}

using System;

namespace _139_A_Petr_and_Book
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] s = Console.ReadLine().Split(' ');
            int[] a = Array.ConvertAll(s, int.Parse);
            int sum = 0;
            int index = 0;
            while (sum<n)
            {
                for (int i = 0; i < 7; i++)
                {
                    if (sum < n)
                    {
                        sum = sum + a[i];
                        index = i + 1;
                    }
                }

            }
            Console.WriteLine(index);

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Globalization;
using System.Threading;
using System.Collections;
using System.IO;

namespace AcmSolution
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            //Console.SetIn(new StreamReader("gcd.in"));
           // Console.SetOut(new StreamWriter("gcd.out"));
            Do();
            //Console.Out.Close();
            Console.ReadLine();
        }

        private static void Do()
        {
            int n = GetInt();
            int[] pages = GetInts();
            int sum = pages.Sum();
            int index = 1;
            if (n > sum)
            {
                for (int i = 0; i < 1000000000; i++)
                {
                    n = n - sum;
                    if (n <= sum)
                        break;
                }
            }
            for (int i = 0; i < pages.Length; i++)
            {
                n = n - pages[i];
                if (n <= 0)
                {
                    index = index + i;
                    break;
                }
            }
            Console.WriteLine(index);
        }

        #region Utils
        private const double Epsilon = 0.00000001;

        private static string GetStr()
        {
            return Console.ReadLine();
        }

        private static string[] GetStrs()
        {
            return GetStr().Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
        }

        private static string[] GetStrs(int cnt)
        {
            var s = new string[cnt];
            for (var i = 0; i < cnt; ++i)
                s[i] = GetStr();
            return s;
        }

        private static int GetInt()
        {
            return int.Parse(GetStr());
        }

        private static void GetInts(out int a, out int b)
        {
            var q = GetInts();
            a = q[0];
            b = q[1];
        }

        private static void GetInts(out int a, out int b, out int c)
        {
            var q = GetInts();
            a = q[0];
            b = q[1];
            c = q[2];
        }

        private static int[] GetInts()
        {
            var s = GetStrs();
            var a = new int[s.Length];
            for (var i = 0; i < s.Length; ++i)
                a[i] = int.Parse(s[i]);
            return a;
        }

        private static long GetLong()
        {
            return long.Parse(GetStr());
        }

        private static IEnumerable<long> GetLongs()
        {
            return GetStrs().Select(long.Parse);
        }

        private static void WriteDouble<T>(T d)
        {
            Console.WriteLine(string.Format("{0:0.000000000}", d).Replace(',', '.'));
        }

        private static void WL<T>(T s)
        {
            Console.WriteLine(s);
        }

        private static void W<T>(T s)
        {
            Console.Write(s);
        }

        private static void Assert(bool b)
        {
            if (!b) throw new Exception();
        }

        private static void Swap<T>(ref T a, ref T b)
        {
            var temp = a;
            a = b;
            b = temp;
        }

        #endregion
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication2
{
    class Program
    {

        static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            string[] s = Console.ReadLine().Split(' ');
            int i = 0;
            int[] dni = new int[7];

            for (i = 0; i < 7; i++)
            {
                dni[i] = Convert.ToInt32(s[i]);
            }

            while (n > 0)
            {
                if (i == 7)
                    i = 0;

                n = n - dni[i];
                i++;
            }
            Console.WriteLine(i);

        }
    }
}

using System;
class Codeforce
{
     static void Main()
    {
         int n = int.Parse(Console.ReadLine());
         string []s= Console.ReadLine().Split();
         int i;
         int []a = new int [7];
         for(i=0;i<7;i++)
         {
            a[i]=int.Parse(s[i]);

         }
         i=0;
         while(1>0)
         {
          n-=a[i];
          if(n<=0)
          { break; }

          i++;
          if(i==7)
           i=0;
         }

         Console.WriteLine(i+1);
    }
}

using System;

namespace Test
{
    class MainClass
    {
        public static void Main (string[] args)
        {
            int n = int.Parse (Console.ReadLine ());
            int s = 0, j;
            int[] a = new int[7];
            string str = Console.ReadLine ();
            string[] numbers = str.Split (' ');
            for (int i = 0; i != 7; i++) {
                a [i] = int.Parse (numbers [i]);
                s += a [i];
            }
            n %= s;
            if (n == 0)
                n += s;
            for (j = 0; j != 7 && n > 0; j++) {
                n -= a [j];
            }
            Console.Write (j);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace Codeforces
{
    class Program
    {
        public static void Main(string[] args)
        {
            int N = IO.GetInt();
            int[] ar = IO.GetInts().ToArray();

            int sum = ar.Sum();
            N %= sum;
            if (N == 0)
                N = sum;

            for (int i = 0; i < 7; i++)
            {
                N -= ar[i];
                if (N < 1)
                {
                    IO.Wl(i + 1);
                    return;
                }
            }
        }
    }

    public class IO
    {
        public static int GetInt()
        {
            return int.Parse(Console.ReadLine());
        }

        public static IEnumerable<int> GetInts()
        {
            foreach (string s in Console.ReadLine().Split())
            {
                yield return int.Parse(s);
            }
        }

        public static void Wl(object o)
        {
            Console.WriteLine(o.ToString());
        }
    }

    public struct Tuple<T, K>
    {
        public T Item1;
        public K Item2;

        public Tuple(T t, K k)
        {
            Item1 = t;
            Item2 = k;
        }

        public override bool Equals(object obj)
        {
            var o = (Tuple<T, K>)obj;
            return o.Item1.Equals(Item1) && o.Item2.Equals(Item2);
        }

        public override int GetHashCode()
        {
            return Item1.GetHashCode() ^ Item2.GetHashCode();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            string[] s = Console.ReadLine().Split(' ');
            int[] a = new int[s.Length];
            for (int i = 0; i < s.Length; i++)
            {
                a[i] = Convert.ToInt32(s[i]);
            }
            int sum = 0; int index=0;
            while (sum < n)
            {
                for (int i = 0; i < a.Length; i++)
                {
                    sum += a[i]; index = i;
                    if (sum >= n) break;
                }
            }
            Console.WriteLine(index + 1);

        }
    }
}

using System;
using System.Text.RegularExpressions;
using System.Collections.Generic;

namespace temp
{
    class MainClass
    {
        private static Int32[] read_ints(int n) {
            string[] str = Console.ReadLine().Split(new char[]{' '});
            Int32[] ret = new Int32[n];
            for (Int32 i = 0; i < n; i++)
                ret[i] = Convert.ToInt32(str[i]);
            return ret;
        }

        private static Int32 read_int() {
            return Convert.ToInt32(Console.ReadLine());
        }

        private static Int64[] read_longs(int n) {
            string[] str = Console.ReadLine().Split(new char[]{' '});
            Int64[] ret = new Int64[n];
            for (Int64 i = 0; i < n; i++)
                ret[i] = Convert.ToInt64(str[i]);
            return ret;
        }

        private static Int64 read_long() {
            return Convert.ToInt64(Console.ReadLine());
        }

        private static string read_line() {
            return Console.ReadLine();
        }

        private static double line_dist_2d (int x1, int y1, int x2, int y2) {
            return Math.Sqrt(Math.Pow(x1-x2, 2) + Math.Pow(y1-y2, 2));
        }

        public static void Main (string[] args)
        {
            int n = read_int();
            int[] arr = read_ints(7);
            int day = 1, cnt = 0;
            while (true) {
                cnt += arr[day-1];
                if (cnt >= n)
                    break;
                day++;
                if (day == 8)
                    day = 1;
            }
            Console.WriteLine(day);
        }
    }
}

using System;
using System.Collections.Generic;

public class Programku
{
  public static void Main ( )
  {
    int pages = int.Parse ( Console.ReadLine ( ) );
    string line = Console.ReadLine ( );
    string[] aline = line.Split ( new char[] { ' ' } );
    int [] d = new int[7];
    for ( int i=0; i < 7; i++ )
    {
      d[i] = int.Parse ( aline[i] );
    }
    int pp = 0;
    int k = 0;
    while ( true )
    {
      pp += d[k];
      if ( pp >= pages )
        break;
      k++;
      if ( k == 7 )
        k = 0;
    }
    Console.WriteLine ( k + 1 );
  }

}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NEwTechTEst
{
    class Program
    {

        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var d = Console.ReadLine().Split(' ').Select(s => int.Parse(s));
            var sum = d.Sum();
            var l = n % sum > 0 ? n % sum : sum;
            int res = 0;
            foreach (var x in d)
            {
                l -= x; res++;
                if (l > 0) continue;
                Console.WriteLine(res);
                break;
            }

        }

    }
}

using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;

namespace PetrAndBook
{
    class Program
    {
        static void Main(string[] args)
        {
            int totalPages = int.Parse(Console.ReadLine());
            int[] pages = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray<int>();
            int currentPage = -1;
            while (totalPages > 0)
            {
                currentPage = (currentPage + 1) % 7;
                totalPages -= pages[currentPage];
            }
            Console.WriteLine(++currentPage);
            Console.ReadLine();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BerFS
{
    class Program
    {
        static void Main(string[] args)
        {
            int pages = Int32.Parse(Console.ReadLine());
            int[] days = Console.ReadLine().Split(' ').Select(x => Int32.Parse(x)).ToArray();
            int sum = 0;
            int day = 0;
            while (sum < pages)
            {
                if (day >= 7)
                    day = 0;
                sum += days[day];
                day++;
            }
            Console.WriteLine(day.ToString());
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace cbr_99_A
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] token = Console.ReadLine().Split();
            int[] week = new int[7];
            for (int i = 0; i < 7; i++)
            {
                week[i]=int.Parse(token[i]);
            }
            int number = 0;
            while (true)
            {
                n -= week[number];
                if (n < 1) break;
                number = (number + 1) % 7;
            }
            Console.WriteLine(number + 1);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            int[] arr = Array.ConvertAll(Console.ReadLine().Split(), int.Parse); ;

            while(n>0)
            {
                for(int j=0;j<7;j++)
                {
                    n -= arr[j];
                     if(n<=0)
                    {
                        Console.WriteLine(j + 1);
                        break;
                    }

                }

            }

        }
    }
}

using System;
using System.Collections;
using System.Collections.Generic;
class solution
{
    static void Main(string[] args)
    {
        int n = Convert.ToInt32(Console.ReadLine());
        int[] arr = Array.ConvertAll(Console.ReadLine().Split(' '), item => Convert.ToInt32(item));
        int total = 0, loopcount = 0, weekday = 0;
        for (int i = 0; i < arr.Length; i++)
            total += arr[i];
        if (n > total) loopcount = Math.Abs(n / total);
        total = 0;
        bool found = false;
        for(int i=0;i<loopcount+1;i++)
        {
            for(int j=0;j<arr.Length;j++)
            {
                total += arr[j];
                if (total >= n)
                {
                    weekday = j + 1;
                    found = true;
                    break;
                }
            }
            if (found) break;
        }
        Console.Write(weekday);
    }
}

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication2
{

    class Program
    {
        internal class StringWork
        {
            //Дополнение ведущими нулями меньшего из чисел
            internal static void dop(ref string a, ref string b)
            {
                if (a.Length > b.Length)
                {
                    int l = a.Length - b.Length;
                    for (int i = 0; i < l; i++)
                    {
                        b = '0' + b;
                    }
                    return;
                }
                else
                {
                    int l = b.Length - a.Length;
                    for (int i = 0; i < l; i++)
                    {
                        a = '0' + a;
                    }
                    return;
                }
            }

            //Перевод в N-ую систему считсления
            internal static string ToCodeN(Int64 Decimal,int n)
            {
                Int64 BinaryHolder;
                char[] BinaryArray;
                string BinaryResult = "";

                while (Decimal > 0)
                {
                    BinaryHolder = Decimal % n;
                    BinaryResult += BinaryHolder;
                    Decimal = Decimal / n;
                }

                BinaryArray = BinaryResult.ToCharArray();
                Array.Reverse(BinaryArray);
                BinaryResult = new string(BinaryArray);
                return BinaryResult;
            }

            //Сложение больших чисел
            static string add(string a, string b)
            {
                string str = "";
                for (int i = a.Length - 1; i >= 0; i--)
                {
                    int k = (int.Parse(a[i].ToString()) + int.Parse(b[i].ToString())) % 3;
                    str = (k).ToString() + str;
                }
                return str;
            }

            //Перевод в десятичную систему
            static string toDec(string str, int n)
            {
                Int64 count = 0, result = 0;
                for (int i = str.Length - 1; i >= 0; --i)
                {
                    int j = int.Parse(str[i].ToString());
                    if (count != 0 || j != 0)
                    {
                        result += (int)Math.Abs(j * Math.Pow(n, count));
                    }
                    count++;
                }

                return (result).ToString();
            }
        }

        internal class SortingArray
        {
            internal static void shellSort(ref int[] vector)
            {
                int step = vector.Length / 2;
                while (step > 0)
                {
                    int i, j;
                    for (i = step; i < vector.Length; i++)
                    {
                        int value = vector[i];
                        for (j = i - step; (j >= 0) && (vector[j] > value); j -= step)
                            vector[j + step] = vector[j];
                        vector[j + step] = value;
                    }
                    step /= 2;
                }
            }
        }
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            //string s = Console.ReadLine();
            string[] s = Console.ReadLine().Split(' ');

            //int[] m = new int[10];

            int k = 0;
            int i = 0;

            while (0 < n)
            {
                if (i > 6)
                    i = 0;

                n -= int.Parse(s[i]);
                i++;
            }

            Console.WriteLine("{0}", i);

        }

    }
}

using System;
using System.Linq;

namespace codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            int t = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            t %= a.Sum();
            if (t == 0)
            {
                Console.WriteLine(1 + Array.LastIndexOf(a, a.Last(x => x != 0)));
                return;
            }
            for (int i = 0; i < 7; i++)
            {
                t -= a[i];
                if (t <= 0)
                {
                    Console.WriteLine(i + 1);
                    return;
                }
            }
        }
    }
}

using System;
class Test {
    static void Main(){
        int n = int.Parse(Console.ReadLine());
        string [] str = Console.ReadLine().Split();
        int i = 0;
        int sum = 0;
        while(sum<n){
            sum += int.Parse(str[i]);
            i++;
            if(i==7){
                i=0;
            }
        }
        if(i==0){
            i=7;
        }
        Console.WriteLine(i);
    }
}

using System;
class MyBuild
{
    static void Main()
    {
        int pagesread = 0, i = 0;
        int n = int.Parse(Console.ReadLine());
        string input = Console.ReadLine();

        string[] strppd = input.Split(' ');
        int[] pageperday = Array.ConvertAll(strppd, int.Parse);

        while (pagesread < n)
        {
            pagesread += pageperday[i];
            i++;
            if (i == 7)
            {
                i = 0;
            }
        }
        Console.WriteLine(i);
    }
}

using System; using System.Linq;

class P {
  static void Main() {
    var n = int.Parse(Console.ReadLine());
    var d = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
    n = n % d.Sum();
    for (var i = 0 ; ; i++)
      if (n <= d[i]) { Console.WriteLine(i + 1); return; }
      else n -= d[i];
  }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using System.IO;
using System.Numerics;
using System.Globalization;
using System.Threading;

namespace probleme {
    class Program {
        static void Main(string[] args) {
            //Console.SetIn(new StreamReader("file.txt"));
            int n = int.Parse(Console.ReadLine());
            int[] w = Array.ConvertAll(Console.ReadLine().Split(' '), tz => int.Parse(tz));
            int s = w.Sum();
            n %= s;
            if (n == 0) {
                Console.Write(7);
            } else {
                for (int i = 0; i < 6; i++) {
                    if (n <= w[i]) {
                        Console.Write(i + 1);
                        break;
                    } else {
                        n -= w[i];
                    }
                }
            }
            //Console.ReadKey();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using System.IO;
using System.Numerics;
using System.Globalization;
using System.Threading;

namespace probleme {
    class Program {
        static void Main(string[] args) {
            //Console.SetIn(new StreamReader("file.txt"));
            int n = int.Parse(Console.ReadLine());
            int[] w = Array.ConvertAll(Console.ReadLine().Split(' '), tz => int.Parse(tz));
            int s = w.Sum();
            n %= s;
            if (n == 0) {
                for (int i = 6; i >= 0; i--) {
                    if (w[i] != 0) {
                        Console.Write(i + 1);
                        break;
                    }
                }
            } else {
                for (int i = 0; i < 6; i++) {
                    if (n <= w[i]) {
                        Console.Write(i + 1);
                        break;
                    } else {
                        n -= w[i];
                    }
                }
            }
            //Console.ReadKey();
        }
    }
}

using System;
using System.Collections.Generic;
using System.IO;

namespace prA {

    class Program {
#if ONLINE_JUDGE
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);
#else
        private static readonly StreamWriter writer = new StreamWriter("output");
        private static readonly StreamReader reader = new StreamReader("input");
#endif
        static void Main(string[] args) {
            int n = Next();
            int[] s = new int[7];
            for(int i = 0; i < 7; i++) {
                if(i > 0)
                    s[i] = s[i - 1];
                s[i] += Next();
            }
            n %= s[6];
            int ans = 0;
            while(ans <7 && n>s[ans]) {
                ans++;
            }
            writer.Write(ans + 1);
            writer.Flush();
#if !ONLINE_JUDGE
            writer.Close();
#endif
        }
        private static int Next() {
            int c;
            int res = 0;
            do {
                c = reader.Read();
                if(c == -1)
                    return res;
            } while(c != '-' && (c < '0' || c > '9'));
            int sign = 1;
            if(c == '-') {
                sign = -1;
                c = reader.Read();
            }
            res = c - '0';
            while(true) {
                c = reader.Read();
                if(c < '0' || c > '9')
                    return res * sign;
                res *= 10;
                res += c - '0';
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.IO;

namespace prA {

    class Program {
#if ONLINE_JUDGE
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);
#else
        private static readonly StreamWriter writer = new StreamWriter("output");
        private static readonly StreamReader reader = new StreamReader("input");
#endif
        static void Main(string[] args) {
            int n = Next();
            int[] s = new int[7];
            for(int i = 0; i < 7; i++) {
                if(i > 0)
                    s[i] = s[i - 1];
                s[i] += Next();
            }
            n %= s[6];
            int ans = n == 0 ? 6 : 0;
            while(n > s[ans]) {
                ans++;
            }
            writer.Write(ans + 1);
            writer.Flush();
#if !ONLINE_JUDGE
            writer.Close();
#endif
        }
        private static int Next() {
            int c;
            int res = 0;
            do {
                c = reader.Read();
                if(c == -1)
                    return res;
            } while(c != '-' && (c < '0' || c > '9'));
            int sign = 1;
            if(c == '-') {
                sign = -1;
                c = reader.Read();
            }
            res = c - '0';
            while(true) {
                c = reader.Read();
                if(c < '0' || c > '9')
                    return res * sign;
                res *= 10;
                res += c - '0';
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NEwTechTEst
{
    class Program
    {

        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var d = Console.ReadLine().Split(' ').Select(s => int.Parse(s));
            var l = n % d.Sum();
            if (l != 0)
            {
                int res = 0;
                foreach (var x in d)
                {
                    l -= x; res++;
                    if (l > 0) continue;
                    Console.WriteLine(res);
                    break;
                }
            }
            else Console.WriteLine(7);
        }

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NEwTechTEst
{
    class Program
    {

        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var d = Console.ReadLine().Split(' ').Select(s => int.Parse(s));
            var l = n % d.Sum();
            int res = 0;
            foreach (var x in d)
            {
                l -= x; res++;
                if (l > 0) continue;
                Console.WriteLine(res);
                break;
            }
        }

    }
}

using System;
using System.Linq;

namespace codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            int t = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            if (t > a.Sum()) t -= a.Sum();
            for (int i = 0; i < 7; i++)
            {
                t -= a[i];
                if (t <= 0)
                {
                    Console.WriteLine(i + 1); ;
                    return;
                }
            }
        }
    }
}

using System;
using System.Linq;

namespace codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            int t = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            t %= a.Sum();
            if (t == 0)
            {
                Console.WriteLine(7);
                return;
            }
            for (int i = 0; i < 7; i++)
            {
                t -= a[i];
                if (t <= 0)
                {
                    Console.WriteLine(i + 1);
                    return;
                }
            }
        }
    }
}

using System;
using System.Linq;

namespace codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            int t = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            if (t > a.Sum()) t %= a.Sum();
            for (int i = 0; i < 7; i++)
            {
                t -= a[i];
                if (t <= 0)
                {
                    Console.WriteLine(i + 1);
                    return;
                }
            }
        }
    }
}

using System;
using System.Linq;

namespace codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            int t = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            t %= a.Sum();
            for (int i = 0; i < 7; i++)
            {
                t -= a[i];
                if (t <= 0)
                {
                    Console.WriteLine(i + 1); ;
                    return;
                }
            }
        }
    }
}

using System;
class Test {
    static void Main(){
        int n = int.Parse(Console.ReadLine());
        string [] str = Console.ReadLine().Split();
        int i = 1;
        int sum = 0;
        while(sum<n){
            if(i==7){
                i=1;
            }
            sum += int.Parse(str[i-1]);
            i++;
        }
        Console.WriteLine(i-1);
    }
}

using System;
class Test {
    static void Main(){
        int n = int.Parse(Console.ReadLine());
        string [] str = Console.ReadLine().Split();
        int i = 0;
        int sum = 0;
        while(sum<n){
            sum += int.Parse(str[i]);
            i++;
            if(i==7){
                i=0;
            }
        }
        Console.WriteLine(i);
    }
}

using System;
using System.Linq;

namespace CSharp
{
    public class _139A
    {
        public static void Main()
        {
            int n = int.Parse(Console.ReadLine()) - 1;
            int[] w = Console.ReadLine().Split().Select(token => int.Parse(token)).ToArray();

            n %= w.Sum();

            for (int i = 0; i < 6; i++)
            {
                if (n < w[i])
                {
                    Console.WriteLine(i + 1);
                    return;
                }

                n -= w[i];
            }
        }
    }
}

using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;

namespace Codeforces
{
    internal class Program
    {
        private static void Main()
        {
            if (Debugger.IsAttached)
            {
                Console.SetIn(new StreamReader(@"..\..\..\..\Tests\A2.in"));
            }

            Solve();

            if (Debugger.IsAttached)
            {
                Console.In.Close();
                Console.SetIn(new StreamReader(Console.OpenStandardInput()));
                Console.ReadLine();
            }
        }

        private static void Solve()
        {
            var n = ReadInt();
            var days = ReadIntArray();
            var sum = days.Sum();
            n %= sum;
            if (n == 0)
            {
                Console.WriteLine(1);
            }
            else
            {
                for (int i = 0; i < days.Length; i++)
                {
                    n -= days[i];
                    if (n <= 0)
                    {
                        Console.WriteLine(i+1);
                        return;
                    }
                }
            }
        }

        #region Reader

        private static string Read()
        {
            return Console.ReadLine();
        }

        private static string[] ReadArray()
        {
            return Console.ReadLine().Split(' ');
        }

        private static int[] ReadIntArray()
        {
            var input = Console.ReadLine().Split(' ').Select(Int32.Parse).ToArray();
            return input;
        }

        private static int ReadInt()
        {
            return Int32.Parse(Console.ReadLine());
        }

        private static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }

        private static int ReadNextInt(string[] input, int index)
        {
            return Int32.Parse(input[index]);
        }

        #endregion
    }
}

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication2
{

    class Program
    {
        internal class StringWork
        {
            //Дополнение ведущими нулями меньшего из чисел
            internal static void dop(ref string a, ref string b)
            {
                if (a.Length > b.Length)
                {
                    int l = a.Length - b.Length;
                    for (int i = 0; i < l; i++)
                    {
                        b = '0' + b;
                    }
                    return;
                }
                else
                {
                    int l = b.Length - a.Length;
                    for (int i = 0; i < l; i++)
                    {
                        a = '0' + a;
                    }
                    return;
                }
            }

            //Перевод в N-ую систему считсления
            internal static string ToCodeN(Int64 Decimal,int n)
            {
                Int64 BinaryHolder;
                char[] BinaryArray;
                string BinaryResult = "";

                while (Decimal > 0)
                {
                    BinaryHolder = Decimal % n;
                    BinaryResult += BinaryHolder;
                    Decimal = Decimal / n;
                }

                BinaryArray = BinaryResult.ToCharArray();
                Array.Reverse(BinaryArray);
                BinaryResult = new string(BinaryArray);
                return BinaryResult;
            }

            //Сложение больших чисел
            static string add(string a, string b)
            {
                string str = "";
                for (int i = a.Length - 1; i >= 0; i--)
                {
                    int k = (int.Parse(a[i].ToString()) + int.Parse(b[i].ToString())) % 3;
                    str = (k).ToString() + str;
                }
                return str;
            }

            //Перевод в десятичную систему
            static string toDec(string str, int n)
            {
                Int64 count = 0, result = 0;
                for (int i = str.Length - 1; i >= 0; --i)
                {
                    int j = int.Parse(str[i].ToString());
                    if (count != 0 || j != 0)
                    {
                        result += (int)Math.Abs(j * Math.Pow(n, count));
                    }
                    count++;
                }

                return (result).ToString();
            }
        }

        internal class SortingArray
        {
            internal static void shellSort(ref int[] vector)
            {
                int step = vector.Length / 2;
                while (step > 0)
                {
                    int i, j;
                    for (i = step; i < vector.Length; i++)
                    {
                        int value = vector[i];
                        for (j = i - step; (j >= 0) && (vector[j] > value); j -= step)
                            vector[j + step] = vector[j];
                        vector[j + step] = value;
                    }
                    step /= 2;
                }
            }
        }
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            //string s = Console.ReadLine();
            string[] s = Console.ReadLine().Split(' ');

            //int[] m = new int[10];

            int k = 0;
            int i = 0;
            while (0 <= n)
            {
                if (i >= 6)
                    i = 0;
                n -= int.Parse(s[i]);
                i++;
            }

            Console.WriteLine("{0}", i);

        }

    }
}

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication2
{

    class Program
    {
        internal class StringWork
        {
            //Дополнение ведущими нулями меньшего из чисел
            internal static void dop(ref string a, ref string b)
            {
                if (a.Length > b.Length)
                {
                    int l = a.Length - b.Length;
                    for (int i = 0; i < l; i++)
                    {
                        b = '0' + b;
                    }
                    return;
                }
                else
                {
                    int l = b.Length - a.Length;
                    for (int i = 0; i < l; i++)
                    {
                        a = '0' + a;
                    }
                    return;
                }
            }

            //Перевод в N-ую систему считсления
            internal static string ToCodeN(Int64 Decimal,int n)
            {
                Int64 BinaryHolder;
                char[] BinaryArray;
                string BinaryResult = "";

                while (Decimal > 0)
                {
                    BinaryHolder = Decimal % n;
                    BinaryResult += BinaryHolder;
                    Decimal = Decimal / n;
                }

                BinaryArray = BinaryResult.ToCharArray();
                Array.Reverse(BinaryArray);
                BinaryResult = new string(BinaryArray);
                return BinaryResult;
            }

            //Сложение больших чисел
            static string add(string a, string b)
            {
                string str = "";
                for (int i = a.Length - 1; i >= 0; i--)
                {
                    int k = (int.Parse(a[i].ToString()) + int.Parse(b[i].ToString())) % 3;
                    str = (k).ToString() + str;
                }
                return str;
            }

            //Перевод в десятичную систему
            static string toDec(string str, int n)
            {
                Int64 count = 0, result = 0;
                for (int i = str.Length - 1; i >= 0; --i)
                {
                    int j = int.Parse(str[i].ToString());
                    if (count != 0 || j != 0)
                    {
                        result += (int)Math.Abs(j * Math.Pow(n, count));
                    }
                    count++;
                }

                return (result).ToString();
            }
        }

        internal class SortingArray
        {
            internal static void shellSort(ref int[] vector)
            {
                int step = vector.Length / 2;
                while (step > 0)
                {
                    int i, j;
                    for (i = step; i < vector.Length; i++)
                    {
                        int value = vector[i];
                        for (j = i - step; (j >= 0) && (vector[j] > value); j -= step)
                            vector[j + step] = vector[j];
                        vector[j + step] = value;
                    }
                    step /= 2;
                }
            }
        }
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            //string s = Console.ReadLine();
            string[] s = Console.ReadLine().Split(' ');

            //int[] m = new int[10];

            int k = 0;
            int i = 0;
            while (0 <= n)
            {
                if (i > 6)
                    i = 0;
                n -= int.Parse(s[i]);
                i++;
            }

            Console.WriteLine("{0}", i);

        }

    }
}

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication2
{

    class Program
    {
        internal class StringWork
        {
            //Дополнение ведущими нулями меньшего из чисел
            internal static void dop(ref string a, ref string b)
            {
                if (a.Length > b.Length)
                {
                    int l = a.Length - b.Length;
                    for (int i = 0; i < l; i++)
                    {
                        b = '0' + b;
                    }
                    return;
                }
                else
                {
                    int l = b.Length - a.Length;
                    for (int i = 0; i < l; i++)
                    {
                        a = '0' + a;
                    }
                    return;
                }
            }

            //Перевод в N-ую систему считсления
            internal static string ToCodeN(Int64 Decimal,int n)
            {
                Int64 BinaryHolder;
                char[] BinaryArray;
                string BinaryResult = "";

                while (Decimal > 0)
                {
                    BinaryHolder = Decimal % n;
                    BinaryResult += BinaryHolder;
                    Decimal = Decimal / n;
                }

                BinaryArray = BinaryResult.ToCharArray();
                Array.Reverse(BinaryArray);
                BinaryResult = new string(BinaryArray);
                return BinaryResult;
            }

            //Сложение больших чисел
            static string add(string a, string b)
            {
                string str = "";
                for (int i = a.Length - 1; i >= 0; i--)
                {
                    int k = (int.Parse(a[i].ToString()) + int.Parse(b[i].ToString())) % 3;
                    str = (k).ToString() + str;
                }
                return str;
            }

            //Перевод в десятичную систему
            static string toDec(string str, int n)
            {
                Int64 count = 0, result = 0;
                for (int i = str.Length - 1; i >= 0; --i)
                {
                    int j = int.Parse(str[i].ToString());
                    if (count != 0 || j != 0)
                    {
                        result += (int)Math.Abs(j * Math.Pow(n, count));
                    }
                    count++;
                }

                return (result).ToString();
            }
        }

        internal class SortingArray
        {
            internal static void shellSort(ref int[] vector)
            {
                int step = vector.Length / 2;
                while (step > 0)
                {
                    int i, j;
                    for (i = step; i < vector.Length; i++)
                    {
                        int value = vector[i];
                        for (j = i - step; (j >= 0) && (vector[j] > value); j -= step)
                            vector[j + step] = vector[j];
                        vector[j + step] = value;
                    }
                    step /= 2;
                }
            }
        }
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            //string s = Console.ReadLine();
            string[] s = Console.ReadLine().Split(' ');

            //int[] m = new int[10];

            int k = 0;
            int i = 0;
            while (0 <= n)
            {
                n -= int.Parse(s[i]);
                if (i >= 7)
                    i = 0;
                k++;
            }

            Console.WriteLine("{0}", k-1);

        }

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] y = Console.ReadLine().Split(' ');
            int[] a = new int[7];
            for (int i = 0; i < a.Length; i++)
            {
                a[i] = int.Parse(y[i]);
            }
            int nn = 0;
            while (n >= 0)
            {
                n -= a[nn];
                nn++;
                if (nn == 7)
                    nn = 0;
            }
            Console.Write(nn);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] y = Console.ReadLine().Split(' ');
            int[] a = new int[7];
            for (int i = 0; i < a.Length; i++)
            {
                a[i] = int.Parse(y[i]);
            }
            int nn = 0;
            while (n > 0)
            {
                n -= a[nn];
                nn++;
                if (nn == 7)
                    nn = 0;
            }
            Console.Write(nn);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] y = Console.ReadLine().Split(' ');
            int[] a = new int[7];
            for (int i = 0; i < a.Length; i++)
            {
                a[i] = int.Parse(y[i]);
            }
            int nn = 0;
            while (n > 0)
            {
                 if(n<=0)
                break;
                n -= a[nn];
                nn++;
                if (nn == 7)
                    nn = 0;
                if(n<=0)
                break;
            }
            Console.Write(nn);
        }
    }
}

using System;
using System.Collections.Generic;

public class Programku
{
  public static void Main ( )
  {
    int pages = int.Parse ( Console.ReadLine ( ) );
    string line = Console.ReadLine ( );
    string[] aline = line.Split ( new char[] { ' ' } );
    int [] d = new int[7];
    for ( int i=0; i < 7; i++ )
    {
      d[i] = int.Parse ( aline[i] );
    }
    int pp = 0;
    int k = 0;
    while ( pp < pages )
    {
      pp += d[k];
      k++;
      if ( k == 7 )
        k = 0;
    }
    Console.WriteLine ( k );
  }

}

using System;
using System.Collections.Generic;

public class Programku
{
  public static void Main ( )
  {
    int pages = int.Parse ( Console.ReadLine ( ) );
    string line = Console.ReadLine ( );
    string[] aline = line.Split ( new char[] { ' ' } );
    int [] d = new int[7];
    for ( int i=0; i < 7; i++ )
    {
      d[i] = int.Parse ( aline[i] );
    }
    int pp = 0;
    int k = 0;
    while ( true )
    {
      pp += d[k];
      if ( pp >= pages )
        break;
      k++;
      if ( k == 7 )
        k = 0;
    }
    Console.WriteLine ( k );
  }

}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Globalization;
using System.Threading;
using System.Collections;
using System.IO;

namespace AcmSolution
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            //Console.SetIn(new StreamReader("gcd.in"));
           // Console.SetOut(new StreamWriter("gcd.out"));
            Do();
            //Console.Out.Close();
            Console.ReadLine();
        }

        private static void Do()
        {
            int n = GetInt();
            int[] pages = GetInts();
            int sum = pages.Sum();
            int index = 1;
            if (n > sum)
            {
                for (int i = 0; i < n; i++)
                {
                    n = n - sum;
                    if (n <= sum)
                        break;
                }
            }
            for (int i = 0; i < pages.Length; i++)
            {
                n = n - pages[i];
                if (n <= 0)
                {
                    index = index + i;
                    break;
                }
            }
            Console.WriteLine(index);
        }

        #region Utils
        private const double Epsilon = 0.00000001;

        private static string GetStr()
        {
            return Console.ReadLine();
        }

        private static string[] GetStrs()
        {
            return GetStr().Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
        }

        private static string[] GetStrs(int cnt)
        {
            var s = new string[cnt];
            for (var i = 0; i < cnt; ++i)
                s[i] = GetStr();
            return s;
        }

        private static int GetInt()
        {
            return int.Parse(GetStr());
        }

        private static void GetInts(out int a, out int b)
        {
            var q = GetInts();
            a = q[0];
            b = q[1];
        }

        private static void GetInts(out int a, out int b, out int c)
        {
            var q = GetInts();
            a = q[0];
            b = q[1];
            c = q[2];
        }

        private static int[] GetInts()
        {
            var s = GetStrs();
            var a = new int[s.Length];
            for (var i = 0; i < s.Length; ++i)
                a[i] = int.Parse(s[i]);
            return a;
        }

        private static long GetLong()
        {
            return long.Parse(GetStr());
        }

        private static IEnumerable<long> GetLongs()
        {
            return GetStrs().Select(long.Parse);
        }

        private static void WriteDouble<T>(T d)
        {
            Console.WriteLine(string.Format("{0:0.000000000}", d).Replace(',', '.'));
        }

        private static void WL<T>(T s)
        {
            Console.WriteLine(s);
        }

        private static void W<T>(T s)
        {
            Console.Write(s);
        }

        private static void Assert(bool b)
        {
            if (!b) throw new Exception();
        }

        private static void Swap<T>(ref T a, ref T b)
        {
            var temp = a;
            a = b;
            b = temp;
        }

        #endregion
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Globalization;
using System.Threading;
using System.Collections;
using System.IO;

namespace AcmSolution
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            //Console.SetIn(new StreamReader("gcd.in"));
           // Console.SetOut(new StreamWriter("gcd.out"));
            Do();
            //Console.Out.Close();
            Console.ReadLine();
        }

        private static void Do()
        {
            int n = GetInt();
            int[] pages = GetInts();
            int sum = pages.Sum();
            int index = 0;
            if (n > sum)
            {
                for (int i = 0; i < n; i++)
                {
                    n = n - sum;
                    if (n <= sum)
                        break;
                }
            }
            for (int i = 0; i < pages.Length; i++)
            {
                n = n - pages[i];
                if (n <= 0)
                {
                    index = i + 1;
                    break;
                }
            }
            Console.WriteLine(index);
        }

        #region Utils
        private const double Epsilon = 0.00000001;

        private static string GetStr()
        {
            return Console.ReadLine();
        }

        private static string[] GetStrs()
        {
            return GetStr().Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
        }

        private static string[] GetStrs(int cnt)
        {
            var s = new string[cnt];
            for (var i = 0; i < cnt; ++i)
                s[i] = GetStr();
            return s;
        }

        private static int GetInt()
        {
            return int.Parse(GetStr());
        }

        private static void GetInts(out int a, out int b)
        {
            var q = GetInts();
            a = q[0];
            b = q[1];
        }

        private static void GetInts(out int a, out int b, out int c)
        {
            var q = GetInts();
            a = q[0];
            b = q[1];
            c = q[2];
        }

        private static int[] GetInts()
        {
            var s = GetStrs();
            var a = new int[s.Length];
            for (var i = 0; i < s.Length; ++i)
                a[i] = int.Parse(s[i]);
            return a;
        }

        private static long GetLong()
        {
            return long.Parse(GetStr());
        }

        private static IEnumerable<long> GetLongs()
        {
            return GetStrs().Select(long.Parse);
        }

        private static void WriteDouble<T>(T d)
        {
            Console.WriteLine(string.Format("{0:0.000000000}", d).Replace(',', '.'));
        }

        private static void WL<T>(T s)
        {
            Console.WriteLine(s);
        }

        private static void W<T>(T s)
        {
            Console.Write(s);
        }

        private static void Assert(bool b)
        {
            if (!b) throw new Exception();
        }

        private static void Swap<T>(ref T a, ref T b)
        {
            var temp = a;
            a = b;
            b = temp;
        }

        #endregion
    }
}

using System;

namespace Test
{
    class MainClass
    {
        public static void Main (string[] args)
        {
            int n = int.Parse (Console.ReadLine ());
            int s = 0, j;
            int[] a = new int[7];
            string str = Console.ReadLine ();
            string[] numbers = str.Split (' ');
            for (int i = 0; i != 7; i++) {
                a[i] = int.Parse (numbers[i]);
                s += a[i];
            }
            n %= s;
            if (n > 0) {
                for (j = 0; j != 7 && n > 0; j++) {
                    n -= a [j];
                }
                Console.Write (j);
            } else
                Console.Write ("1");
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApp1
{
    internal class Program
    {

        private static void Main(string[] args)
        {
            string input = Console.ReadLine();
            int n = int.Parse(input);

            var daysReading = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();
            var pagesPerWeek = daysReading.Sum();
            int rem = n % pagesPerWeek;
            for(int i = 1;i<=7;i++)
            {
                rem -= daysReading[i - 1];
                if(rem<=0)
                {
                    Console.WriteLine(i);
                 //     Console.ReadKey();
                    return;
                }

            }

          // Console.WriteLine(count);
         //  Console.ReadKey();
        }

        // Console.ReadKey();

    }

}


using System;
using System.IO;
    class Program
    {
        static void Main()
        {
            string[] arrs;
            arrs = Console.ReadLine().Split(new char[] { ' ' });
            int a = int.Parse(arrs[0]);
            int b = int.Parse(arrs[1]);
            if (a != 1 && b != 1)
            {
                Console.WriteLine("1");
            }
            if (a != 2 && b != 2)
            {
                Console.WriteLine("2");
            }

            if (a != 3 && b != 3)
            {
                Console.WriteLine("3");
            }
        }
    }

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeForceBrothers
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] tmp = Console.ReadLine().Split(' ');
            int a = int.Parse(tmp[0]);
            int b = int.Parse(tmp[1]);
            if (((a == 1) && (b == 3)) || ((a == 3) && (b == 1)))  Console.WriteLine(2);
            else
                if (((a == 1) && (b == 2)) || ((a == 2) && (b == 1))) Console.WriteLine(3);
            else
                Console.WriteLine(1);
        }
    }
}

using System;

namespace ConsoleApplication40
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            string[] ss = s.Split(' ');
            int a = Convert.ToInt32(ss[0]);
            int b = Convert.ToInt32(ss[1]);

            Console.WriteLine(6-(a+ b));

        }
    }
}

using System;

namespace a
{
    class Program
    {
        static void Main()
        {
            int sum = 6;
            string s = Console.ReadLine();
            int number1 = int.Parse(s[0].ToString());
            int number2 = int.Parse(s[s.Length - 1].ToString());
            if (number1 == 1 || number1 == 2 || number1 == 3)
            {
                if (number2 != number1)
                {
                    if (number2 == 1 || number2 == 2 || number2 == 3)
                    {
                        int check = number1 + number2;
                        int result = sum - check;
                        Console.WriteLine(result);
                    }
                }
            }
        }
    }
}

#define reg
using System;
using System.Security.Cryptography;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

namespace CodinGame
{
    class Program
    {
        static void Main(string[] args)
        {
#if reg
            string input = Console.ReadLine();
            if (input.Contains('2') && input.Contains('3')) { Console.WriteLine("1"); return; }
            else if (input.Contains('1') && input.Contains('3')) { Console.WriteLine("2"); return; }
            else { Console.WriteLine("3"); return; }
#endif
        }

        #region Merge with recurtion
        public static void MergeSort(ref int[] input, int left, int right)
        {
            if (left < right)
            {
                int middle = (left + right) / 2;

                MergeSort(ref input, left, middle);
                MergeSort(ref input, middle + 1, right);

                //Merge
                int[] leftArray = new int[middle - left + 1];
                int[] rightArray = new int[right - middle];

                Array.Copy(input, left, leftArray, 0, middle - left + 1);
                Array.Copy(input, middle + 1, rightArray, 0, right - middle);

                int i = 0;
                int j = 0;
                for (int k = left; k < right + 1; k++)
                {
                    if (i == leftArray.Length)
                    {
                        input[k] = rightArray[j];
                        j++;
                    }
                    else if (j == rightArray.Length)
                    {
                        input[k] = leftArray[i];
                        i++;
                    }
                    else if (leftArray[i] <= rightArray[j])
                    {
                        input[k] = leftArray[i];
                        i++;
                    }
                    else
                    {
                        input[k] = rightArray[j];
                        j++;
                    }
                }
            }
        }
        #endregion

        #region merge V2
        public static List<int> merge(List<int> a, List<int> b)
        //������� ������� ��� �������
        {
            List<int> c = new List<int>();
            //���������� �������������� ������
            int kol1 = 0;//� ������� �
            int kol2 = 0;//� ������� b
            //�������� ������ c
            for (int i = 0; i < a.Count + b.Count; i++)
            {
                //���� �� ��� ��������� ������������ ������� �,
                //�� ��� �������� �������� �������� ������� b
                if (kol1 == a.Count)
                {
                    c.Add(b[kol2]);
                    kol2++;
                    continue;
                }
                //��������
                if (kol2 == b.Count)
                {
                    c.Add(a[kol1]);
                    kol1++;
                    continue;
                }
                //��� ��� ���� ������� ��� �� ���������
                //������������, �� ����� �������� �����
                //�������� ������� �� ��������� �����
                if (a[kol1] <= b[kol2])
                {
                    c.Add(a[kol1]);
                    kol1++;
                }
                else
                {
                    c.Add(b[kol2]);
                    kol2++;
                }
            }
            return c;
        }

        //������� ��������� ������
        public static List<int> merge_sort(List<int> a)
        {
            //���� ������ ������� ������ 1,
            //�� �� ������������
            if (a.Count <= 1)
                return a;
            List<int> b = new List<int>();
            List<int> c = new List<int>();
            b = a.GetRange(0, a.Count / 2);
            //Console.WriteLine("vector b: ");
            //foreach (var pr in b)
            //{
            //    Console.Write(pr);
            //    Console.Write(' ');
            //}
            //Console.WriteLine("\nvector c: ");
            c = a.GetRange(a.Count / 2, a.Count - (a.Count / 2));
            //foreach (var pr in c)
            //{
            //    Console.Write(pr);
            //    Console.Write(' ');
            //}
            //Console.WriteLine();
            return merge(merge_sort(b), merge_sort(c));
        }
        #endregion
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeForceBrothers
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] tmp = Console.ReadLine().Split(' ');
            int a = int.Parse(tmp[0]);
            int b = int.Parse(tmp[1]);
            if ((a == 1) && (b == 3)) Console.WriteLine(2);
            else
                if ((a == 1) && (b == 2)) Console.WriteLine(3);
            else
                Console.WriteLine(1);
        }
    }
}