a=gets[/.{#{d=$_.size/2}}/].to_i-($&.reverse>$'?2:1)+10**(-~d/2) p a%M=10**9,a%=M+7