


'''simple docstring'''



from bisect import bisect
from itertools import accumulate







def     _UpperCamelCase      (		UpperCamelCase__ ,      UpperCamelCase__ ,      UpperCamelCase__ ,      UpperCamelCase__					):
			UpperCAmelCase__  :					str        =     sorted(zip(UpperCamelCase__ ,      UpperCamelCase__					) ,      key=lambda UpperCamelCase__					: x[0] / x[1] ,      reverse=UpperCamelCase__					)
			UpperCAmelCase__   ,       UpperCAmelCase__  :					List[str]        =     [i[0] for i in r], [i[1] for i in r]
			UpperCAmelCase__  :					Any        =     list(accumulate(UpperCamelCase__					)					)
			UpperCAmelCase__  :					Optional[Any]        =     bisect(UpperCamelCase__ ,      UpperCamelCase__					)
			return (
			    0
			    if k == 0
			    else sum(vl[:k]					) + (w - acc[k - 1]) * (vl[k]) / (wt[k])
			    if k != n
			    else sum(vl[:k]					)
			)


if __name__ == "__main__":
		import doctest

		doctest.testmod()



'''simple docstring'''



from itertools import permutations







def     _UpperCamelCase      (		UpperCamelCase__					):
			if num[3] % 2 != 0:
						return False

			if (num[2] + num[3] + num[4]) % 3 != 0:
						return False

			if num[5] % 5 != 0:
						return False

			UpperCAmelCase__  :					Optional[int]        =     [7, 1_1, 1_3, 1_7]
			for i, test in enumerate(UpperCamelCase__					):
						if (num[i + 4] * 1_0_0 + num[i + 5] * 1_0 + num[i + 6]) % test != 0:
									return False
			return True







def     _UpperCamelCase      (		UpperCamelCase__ = 1_0					):
			return sum(
			    int("""""".join(map(UpperCamelCase__ ,      UpperCamelCase__					)					)					)
			    for num in permutations(range(UpperCamelCase__					)					)
			    if is_substring_divisible(UpperCamelCase__					)					)


if __name__ == "__main__":
		print(f"""{solution() = }""")