Do you think that escaping a dream is easy? This is not the case when the dream is about bits. You surely read too much about bit theory yesterday, but this does not matter now, as the only thing you want is to escape from the dream. Perhaps you found the best special string incorrectly... or maybe they have just cheated you. Still, you have a long string of bits in front of your closed eyes.
Then you realize that you have the ability to change the leftmost bit of this string from to or from to . It takes you exactly four seconds, but you can do it!
Then you realize that you can also cyclically shift this string by one position to the left or to the right. Each of these actions takes exactly seven seconds in this strange dream.
Something tells you that the -bits in the string are what is keeping you in the dream. If this is true, you decide to turn the string into a string of all zeroes—you know that you have everything required for that.
But how much time will it take you if you act optimally?
The only line contains (2 \leq |S| \leq 2\cdot 10^5), the string consisting of zeroes and ones.
Print the minimum time (in seconds) required to turn into a string of all zeroes.
Example 1
In the first test case, the optimal strategy is as follows: change the leftmost bit to get , shift the string cyclically to the left to get , change the leftmost bit to get , shift the string cyclically to the right to get , shift the string cyclically to the right again to get , and then change the leftmost bit to get . Three changes and three cyclic shifts take exactly seconds.