This code works well in my computer but codechef submission shows it as wrong.
I am new to codechef. please help me where am I doing wrong, this is the question:
t=int(input())
count=[]
for i in range(t):
n,m=map(int,input().split())
x,y,s=map(int,input().split())
hor=[]
ver=[]
if(x!=0):
hor=input().split()
hor=[int(i) for i in hor]
if(y!=0):
ver=input().split()
ver=[int(i) for i in ver]
hor.append(n+1)
ver.append(m+1)
x=0
k1=0
for i in hor:
k2=0
for j in ver:
x+=(int(i-k1-1)/s)*int((j-k2-1)/s)
k2=j
k1=i
count.append(x)
for i in count:
print(int(i))