We will call a string consisting of characters 0, 2, 5, and/or 6 a New Year string if at least one of the two conditions is met:
For example, the strings 20252026, 21026, 20262026, 000 are New Year strings. The strings 2025, 20256, 20252025, 000202500020226 are not New Year strings.
You are given a string $$$s$$$. You can perform the following operation any number of times (possibly zero):
Calculate the minimum number of operations needed to make the string $$$s$$$ a New Year string.
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases.
Each test case consists of two lines:
For each test case, output one integer — the minimum number of operations needed to make the string $$$s$$$ a New Year string.
740000420254202682025202682025202592025202569202520265
0100110
In the second example from the statement, you can replace the $$$2$$$-nd character of the string with 2. Then the string will become 2225.
In the fifth example from the statement, you can replace the $$$4$$$-th character with 6. Then the string will become 20262025.
In the sixth example from the statement, you can replace the $$$8$$$-th character with 6. Then the string will become 202520266.