F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Sum the K-th's

Time Limit: 5000/3000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)
Total Submission(s): 383    Accepted Submission(s): 63


Problem Description
N integers are arranged on a circle clockwise. Given two integers M & K. For each position, you should take M continuous integers on the left and M continuous integers on the right. Take out the K-th number of the 2M integers. Then you will get N integers. Add all the integers up and tell me the sum. If the answer is not smaller than 1,000,000,007, divide it by 1,000,000,007 and tell me the remainder.

 

Input
There is an Integer T in the first line. Which means the number of test cases in the input file. Then followed by T test cases.
For each test case, in the first line there are 3 Integers N(5<=N<=100,000),M(0<M*2<N),K(0<K<£½2*M). Then there are N Integers, all the integers are non-negative Integers and smaller than 1,000,000,000.
 

Output
For each test case, output the answer for a line.
 

Sample Input
2 5 2 2 1 2 3 4 5 5 1 2 1 2 3 4 5
 

Sample Output
12 21
 

Author
Sempr|CrazyBird|hust07p43
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-05-10 11:38:17, Gzip enabled