use bigint;<>=~/ /;$x=$`;$r+=(0+$x)->bmodpow($_,1e6+3)for<>=~/\S+/g;print$r%1000003