题目描述
Square Inc. processes thousands of transactions daily amounting to millions of dollars. They also have a daily target
that they must achieve. Given a list of transactions done by Square Inc. and a daily target your task is to determine at
which transaction does Square achieves the same.
Input:
First line contains T, number of transactions done by Square in a day.
The following line contains T integers, the worth of each transactions.
Next line contains Q, the no of queries.
Next Q lines contain an integer each representing the daily target.
Output:
For each query, print the transaction number where the daily limit is achieved or -1 if the target can't be achieved.
Constraints:
1 ≤ T ≤100000
1 ≤ Ai ≤1000
1 ≤ Target ≤ 10^9
1 ≤ Q ≤ 1000000
Problem statement in native language : http://hck.re/7Hb1a3
SAMPLE INPUT
5
1 2 1 3 4
3
4
2
10SAMPLE OUTPUT
3
2
5
样例输入
100
34 37 28 16 44 36 37 43 50 22 13 28 41 10 14 27 41 27 23 37 12 19 18 30 33 31 13 24 18 36 30 3 23 9 20 18 44 7 12 43 30 24 22 20 35 38 49 25 16 21 14 27 42 31 7 24 13 21 47 32 6 26 35 28 37 6 47 30 14 8 25 46 33 46 15 18 35 15 44 1 38 9 27 29 39 35 4 2 5 50 33 11 27 19 40 13 27 37 45 40
100
2634
2633
2632
2631
2630
2629
2628
2627
2626
2625
2624
2623
2622
2621
2620
2619
2618
2617
2616
2615
2614
2613
2612
2611
2610
2609
2608
2607
2606
2605
2604
2603
2602
2601
2600
2599
2598
2597
2596
2595
2594
2593
2592
2591
2590
2589
2588
2587
2586
2585
2584
2583
2582
2581
2580
2579
2578
2577
2576
2575
2574
2573
2572
2571
2570
2569
2568
2567
2566
2565
2564
2563
2562
2561
2560
2559
2558
2557
2556
2555
2554
2553
2552
2551
2644
2549
2548
2547
2546
2545
2544
2543
2542
2541
2540
2539
2538
2537
2644
2535
样例输出
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
99
-1
98
98
98
98
98
98
98
98
98
98
98
98
98
-1
98