Login


H. DP(NORMAL)
Time limit per test: 2 second
Memory limit per test: 64 megabytes

Sizga N ta son berilgan va M ta so`rov berilgan va har bir so`rovda L, R oraliqdagi sonlar yig`indisi topish beriladi, sizning vazifangiz shu so`ravlarning summasini 109 + 7 ga bo`lgandagi qoldiqni topish!

Input:
Birinchi qatorda N(0 < N < 106) keyingi satrda N ta ai(0 < ai< 109)kiritiladi. Uchinchi satrda M soni jami so`rovlar soni keyin M(0 < M < 104) ta qatorda L, R (0 < L, R < 104) sonlari kiritiladi.

Output:
Bitta son masala yechimini chop eting!

Input Output
2
1 2
3
1 1
2 2
1 2
6
                 Submit code

Design by TUIT © 2012-2017 TUIT Online Judge. All rights reserved.