Nine Zynoulus is a numerologist, who sees the number 666 and other palindromes everywhere. She thinks that palindromes which are divisible by 666, like or itself, are very important; we call them VIN (Very Important Numbers). Recently, when browsing ancient Measharan inscriptions, she has seen a quite long number , which does not let her sleep easily. She spends her nights counting ways of removing some digits in such the remaining number is a VIN. For example, for she could erase each single digit (in 7 ways), or she could erase four digits (in ways), thus she would get 42 ways. Her intuiton tells her that the number of ways is divisible by 666, so she returns to 1 after counting each 666th way. Please write a program which will let her verify her intuition.
Input is a single integer , .
Return a single number , , which is the number of ways modulo 666.
Input
6666666
Output
42