from decimal import * from fractions import Fraction getcontext().prec=60 mod=10**6+3 invs=[0]*mod invs[1]=1 for i in range(2, mod): invs[i]=mod-invs[mod%i]*(mod//i)%mod def solve(x, v): m=len(v) if m==0: return 1 s=sum(v) if x