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