m@main=do x<-getLine;putStrLn(do n<-[read$take a$drop b$x|a<-[1..9],b<-[0..length x-a]];show$product[1..n-1]^2`mod`max 1n);m