Last active
June 5, 2017 16:51
-
-
Save darkdefender27/2c6168ac4a09742316d786d7f351a1e1 to your computer and use it in GitHub Desktop.
SUMQ.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Author: Shubham Utwal | |
# Alias: darkdefender27 | |
modulo = 1000000007 | |
def f(x, y, z): | |
return ((x+y)%modulo*(y+z)%modulo)%modulo | |
def main(): | |
T = int(raw_input().strip()) | |
for _ in xrange(T): | |
p, q, r = map(int, raw_input().strip().split(' ')) | |
a = map(int, raw_input().strip().split(' ')) | |
b = map(int, raw_input().strip().split(' ')) | |
c = map(int, raw_input().strip().split(' ')) | |
sum = 0 | |
for ii in b: | |
for i in a: | |
if i <= ii: | |
for iii in c: | |
if ii >= iii: | |
sum = (sum + f(i, ii, iii))%modulo | |
print sum%modulo | |
if __name__=='__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment