We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.

taking mod at each value helps in keeping the product in the range of 1234567 so computation will be easy.
concept is (a*b*c) mod 1234567==
(a mod 1234567) * (b mod 1234567) * (c mod 1234567)

## Connecting Towns

You are viewing a single comment's thread. Return to all comments →

why 1234567 why not the other number be taken?

"Output Format Total number of routes from T1 to Tn modulo

1234567"The problem says to output mod 1234567. That is where that number comes from.

but he didnt clearly mention that we have to take mod of each value

taking mod at each value helps in keeping the product in the range of 1234567 so computation will be easy. concept is (a*b*c) mod 1234567== (a mod 1234567) * (b mod 1234567) * (c mod 1234567)

okay..thanks