ZS the Coder is coding on a crazy computer. If you don't type in a word for a c consecutive seconds, everything you typed disappear!
More formally, if you typed a word at second a and then the next word at second b, then if b - a ≤ c, just the new word is appended to other words on the screen. If b - a > c, then everything on the screen disappears and after that the word you have typed appears on the screen.
For example, if c = 5 and you typed words at seconds 1, 3, 8, 14, 19, 20 then at the second 8 there will be 3 words on the screen. After that, everything disappears at the second 13 because nothing was typed. At the seconds 14 and 19 another two words are typed, and finally, at the second 20, one more word is typed, and a total of 3 words remain on the screen.
You're given the times when ZS the Coder typed the words. Determine how many words remain on the screen after he finished typing everything.
For you, numbers have personalities. The number 4 is elegant, 18 is strong and 42 is enigmatic. And, of course, any number ending in 0 is cute.
The more zeroes at the end of a number, the cuter that number is. Therefore 70, 36640 and 1800090 are only a little bit cute (ending in just one zero), whereas 400 and 99200 are very cute (ending in two zeroes) and 30000 is really really cute (ending in four zeroes).
Your task is to read in a number N and determine how many zeroes are at the end of that number, so you can tell just how cute the number is.
Yarr! Welcome aboard the Black Pearl! I'm Captain Mia Swamp, and this is my First Matey, Growlybills. We've heard you're handy with these computing contraptions, so I'll make you a deal: help us out with a little problem, and we won't feed you to the sharks.
You're in? Thought so.
See that map yonder? That long, thin island there is the Isle of Obstaclewick. Boring place. All you need to know is that it's L nautical miles long from east to west, and so thin we all just say it has zero width.
Our ship, the Black Pearl, is sailing the north coast of the island, X nautical miles from the west point. See the other ship, the one sailing the south coast, Y nautical miles from the west point? That's the HMS Smallerout, our target. It may look like a wibbly-wobbly old thing, but it's carrying some of Britain's greatest treasures.
We can sail either way around the Isle of Obstaclewick, approaching the Smallerout from either side. What we want you to do is tell us which way is shorter. We don't want to overwork the... volunteers... in the galley. So that's your job, landlubber! Write us a program that calculates the shortest distance we have to sail to reach the Smallerout!