{"raw_statement":[{"iden":"statement","content":"In distant future on Earth day lasts for _n_ hours and that's why there are _n_ timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to _n_ are used, i.e. there is no time \"0 hours\", instead of it \"_n_ hours\" is used. When local time in the 1\\-st timezone is 1 hour, local time in the _i_\\-th timezone is _i_ hours.\n\nSome online programming contests platform wants to conduct a contest that lasts for an hour in such a way that its beginning coincides with beginning of some hour (in all time zones). The platform knows, that there are _a__i_ people from _i_\\-th timezone who want to participate in the contest. Each person will participate if and only if the contest starts no earlier than _s_ hours 00 minutes local time and ends not later than _f_ hours 00 minutes local time. Values _s_ and _f_ are equal for all time zones. If the contest starts at _f_ hours 00 minutes local time, the person won't participate in it.\n\nHelp platform select such an hour, that the number of people who will participate in the contest is maximum."},{"iden":"input","content":"The first line contains a single integer _n_ (2 ≤ _n_ ≤ 100 000) — the number of hours in day.\n\nThe second line contains _n_ space-separated integers _a_1, _a_2, ..., _a__n_ (1 ≤ _a__i_ ≤ 10 000), where _a__i_ is the number of people in the _i_\\-th timezone who want to participate in the contest.\n\nThe third line contains two space-separated integers _s_ and _f_ (1 ≤ _s_ < _f_ ≤ _n_)."},{"iden":"output","content":"Output a single integer — the time of the beginning of the contest (in the first timezone local time), such that the number of participants will be maximum possible. If there are many answers, output the smallest among them."},{"iden":"examples","content":"Input\n\n3\n1 2 3\n1 3\n\nOutput\n\n3\n\nInput\n\n5\n1 2 3 4 1\n1 3\n\nOutput\n\n4"},{"iden":"note","content":"In the first example, it's optimal to start competition at 3 hours (in first timezone). In this case, it will be 1 hour in the second timezone and 2 hours in the third timezone. Only one person from the first timezone won't participate.\n\nIn second example only people from the third and the fourth timezones will participate."}],"translated_statement":[{"iden":"statement","content":"在遥远的未来，地球的一天持续 #cf_span[n] 小时，因此有 #cf_span[n] 个时区。相邻时区的本地时间相差一小时。本地时间使用从 #cf_span[1] 到 #cf_span[n] 的小时数表示，即不存在 \"0 小时\"，而用 \"#cf_span[n] 小时\" 代替。当第一个时区的本地时间为 #cf_span[1] 小时时，第 #cf_span[i] 个时区的本地时间为 #cf_span[i] 小时。\n\n某个在线编程竞赛平台希望举办一场持续一小时的竞赛，使得其开始时间恰好与每个时区的某个小时的开始时刻一致。平台知道，有 #cf_span[ai] 人来自第 #cf_span[i] 个时区，希望参加此次竞赛。每个人仅当竞赛的开始时间不早于本地时间 #cf_span[s] 小时 00 分，且结束时间不晚于本地时间 #cf_span[f] 小时 00 分时才会参加。值 #cf_span[s] 和 #cf_span[f] 对所有时区都相同。如果竞赛在 #cf_span[f] 小时 00 分本地时间开始，该人将不会参加。\n\n请帮助平台选择一个开始时间，使得参加竞赛的人数最大化。\n\n第一行包含一个整数 #cf_span[n] (#cf_span[2 ≤ n ≤ 100 000]) —— 一天中的小时数。\n\n第二行包含 #cf_span[n] 个空格分隔的整数 #cf_span[a1], #cf_span[a2], ..., #cf_span[an] (#cf_span[1 ≤ ai ≤ 10 000])，其中 #cf_span[ai] 表示第 #cf_span[i] 个时区中希望参加竞赛的人数。\n\n第三行包含两个空格分隔的整数 #cf_span[s] 和 #cf_span[f] (#cf_span[1 ≤ s < f ≤ n])。\n\n请输出一个整数 —— 竞赛的开始时间（以第一个时区的本地时间表示），使得参赛人数尽可能多。如果有多个答案，输出其中最小的那个。\n\n在第一个例子中，最优方案是在第 #cf_span[3] 小时（第一个时区）开始竞赛。此时，第二个时区为 #cf_span[1] 小时，第三个时区为 #cf_span[2] 小时。只有第一个时区的一人不会参加。\n\n在第二个例子中，只有第三和第四个时区的人会参加。"},{"iden":"input","content":"第一行包含一个整数 #cf_span[n] (#cf_span[2 ≤ n ≤ 100 000]) —— 一天中的小时数。\n\n第二行包含 #cf_span[n] 个空格分隔的整数 #cf_span[a1], #cf_span[a2], ..., #cf_span[an] (#cf_span[1 ≤ ai ≤ 10 000])，其中 #cf_span[ai] 表示第 #cf_span[i] 个时区中希望参加竞赛的人数。\n\n第三行包含两个空格分隔的整数 #cf_span[s] 和 #cf_span[f] (#cf_span[1 ≤ s < f ≤ n])。"},{"iden":"output","content":"请输出一个整数 —— 竞赛的开始时间（以第一个时区的本地时间表示），使得参赛人数尽可能多。如果有多个答案，输出其中最小的那个。"},{"iden":"examples","content":"输入：\n3\n1 2 3\n1 3\n\n输出：\n3\n\n输入：\n5\n1 2 3 4 1\n1 3\n\n输出：\n4"},{"iden":"note","content":"在第一个例子中，最优方案是在第 #cf_span[3] 小时（第一个时区）开始竞赛。此时，第二个时区为 #cf_span[1] 小时，第三个时区为 #cf_span[2] 小时。只有第一个时区的一人不会参加。\n\n在第二个例子中，只有第三和第四个时区的人会参加。"}],"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ n \\in \\mathbb{Z} $ be the number of hours in a day (and timezones).  \nLet $ A = (a_1, a_2, \\dots, a_n) \\in \\mathbb{Z}_{>0}^n $, where $ a_i $ is the number of people in timezone $ i $.  \nLet $ s, f \\in \\mathbb{Z} $ be the fixed time window bounds, with $ 1 \\le s < f \\le n $.  \n\n**Constraints**  \n1. $ 2 \\le n \\le 100{,}000 $  \n2. $ 1 \\le a_i \\le 10{,}000 $ for all $ i \\in \\{1, \\dots, n\\} $  \n3. $ 1 \\le s < f \\le n $  \n\n**Objective**  \nLet the contest start at hour $ t \\in \\{1, \\dots, n\\} $ in timezone 1.  \nThen, in timezone $ i $, the local start time is:  \n$$\n\\text{start}_i(t) = ((t - 1 + i - 1) \\bmod n) + 1\n$$  \nThe contest lasts one hour, so it ends at $ \\text{start}_i(t) + 1 $ (mod $ n $, with wraparound).  \n\nA person in timezone $ i $ participates if and only if:  \n$$\ns \\le \\text{start}_i(t) < f\n$$  \n\nDefine the total participants for start time $ t $ as:  \n$$\nP(t) = \\sum_{i=1}^n a_i \\cdot \\mathbf{1}_{\\left[s \\le \\text{start}_i(t) < f\\right]}\n$$  \n\nFind:  \n$$\n\\arg\\max_{t \\in \\{1, \\dots, n\\}} P(t)\n$$  \nIf multiple $ t $ achieve the maximum, return the smallest one.","simple_statement":null,"has_page_source":false}