






from __future__ import annotations







def 	_UpperCamelCase   (    UpperCamelCase_       :					Union[str, Any]    ,       UpperCamelCase_       :					List[str]    ,       UpperCamelCase_       :					str		):

						"""simple docstring"""



						if (voltage, current, resistance).count(0		) != 1:
												raise ValueError('One and only one argument must be 0'		)
						if resistance < 0:
												raise ValueError('Resistance cannot be negative'		)
						if voltage == 0:
												return {"voltage": float(current * resistance		)}
						elif current == 0:
												return {"current": voltage / resistance}
						elif resistance == 0:
												return {"resistance": voltage / current}
						else:
												raise ValueError('Exactly one argument must be 0'		)


if __name__ == "__main__":
					import doctest

					doctest.testmod()













__snake_case    :    Tuple         =     range(2, 20 + 1)
__snake_case    :    str         =     [10**k for k in range(ks[-1] + 1)]
__snake_case    :    dict[int, dict[int, list[list[int]]]]         =     {}







def 	_UpperCamelCase   (    UpperCamelCase_       :					Optional[int]    ,       UpperCamelCase_       :					List[Any]    ,       UpperCamelCase_       :					List[Any]    ,       UpperCamelCase_       :					Tuple		)  ->   List[Any]:

						"""simple docstring"""



						lowerCAmelCase__    						=						sum(a_i[j] for j in range(UpperCamelCase_    ,       len(UpperCamelCase_		)		)		)
						lowerCAmelCase__    						=						sum(a_i[j] * base[j] for j in range(min(len(UpperCamelCase_		)    ,       UpperCamelCase_		)		)		)

						lowerCAmelCase__						,       lowerCAmelCase__    						=						0, 0
						lowerCAmelCase__    						=						n - i

						lowerCAmelCase__    						=						memo.get(UpperCamelCase_		)

						if sub_memo is not None:
												lowerCAmelCase__    						=						sub_memo.get(UpperCamelCase_		)

												if jumps is not None and len(UpperCamelCase_		) > 0:
																		# find and make the largest jump without going over
																		lowerCAmelCase__    						=						-1
																		for _k in range(len(UpperCamelCase_		) - 1    ,       -1    ,       -1		):
																								if jumps[_k][2] <= k and jumps[_k][1] <= max_dn:
																														lowerCAmelCase__    						=						_k
																														break

																		if max_jump >= 0:
																								lowerCAmelCase__						,       lowerCAmelCase__						,       lowerCAmelCase__    						=						jumps[max_jump]
																								# since the difference between jumps is cached, add c
																								lowerCAmelCase__    						=						diff + c
																								for j in range(min(UpperCamelCase_    ,       len(UpperCamelCase_		)		)		):
																														lowerCAmelCase__						,       lowerCAmelCase__    						=						divmod(UpperCamelCase_    ,       10		)
																								if new_c > 0:
																														add(UpperCamelCase_    ,       UpperCamelCase_    ,       UpperCamelCase_		)

												else:
																		lowerCAmelCase__    						=						[]
						else:
												lowerCAmelCase__    						=						{c: []}
												lowerCAmelCase__    						=						sub_memo

						if dn >= max_dn or c + diff >= base[k]:
												return diff, dn

						if k > ks[0]:
												while True:
																		# keep doing smaller jumps
																		lowerCAmelCase__						,       lowerCAmelCase__    						=						next_term(UpperCamelCase_    ,       k - 1    ,       i + dn    ,       UpperCamelCase_		)
																		diff += _diff
																		dn += terms_jumped

																		if dn >= max_dn or c + diff >= base[k]:
																								break
						else:
												# would be too small a jump, just compute sequential terms instead
												lowerCAmelCase__						,       lowerCAmelCase__    						=						compute(UpperCamelCase_    ,       UpperCamelCase_    ,       i + dn    ,       UpperCamelCase_		)
												diff += _diff
												dn += terms_jumped

						lowerCAmelCase__    						=						sub_memo[c]

						# keep jumps sorted by # of terms skipped
						lowerCAmelCase__    						=						0
						while j < len(UpperCamelCase_		):
												if jumps[j][1] > dn:
																		break
												j += 1

						# cache the jump for this value digitsum(b) and c
						sub_memo[c].insert(UpperCamelCase_    ,       (diff, dn, k)		)
						return (diff, dn)







def 	_UpperCamelCase   (    UpperCamelCase_       :					Tuple    ,       UpperCamelCase_       :					List[str]    ,       UpperCamelCase_       :					int    ,       UpperCamelCase_       :					Tuple		)  ->   List[str]:

						"""simple docstring"""



						if i >= n:
												return 0, i
						if k > len(UpperCamelCase_		):
												a_i.extend([0 for _ in range(k - len(UpperCamelCase_		)		)]		)

						# note: a_i -> b * 10^k + c
						# ds_b -> digitsum(b)
						# ds_c -> digitsum(c)
						lowerCAmelCase__    						=						i
						lowerCAmelCase__						,       lowerCAmelCase__						,       lowerCAmelCase__    						=						0, 0, 0
						for j in range(len(UpperCamelCase_		)		):
												if j >= k:
																		ds_b += a_i[j]
												else:
																		ds_c += a_i[j]

						while i < n:
												i += 1
												lowerCAmelCase__    						=						ds_c + ds_b
												diff += addend
												lowerCAmelCase__    						=						0
												for j in range(UpperCamelCase_		):
																		lowerCAmelCase__    						=						a_i[j] + addend
																		lowerCAmelCase__						,       lowerCAmelCase__    						=						divmod(UpperCamelCase_    ,       10		)

																		ds_c += a_i[j]

												if addend > 0:
																		break

						if addend > 0:
												add(UpperCamelCase_    ,       UpperCamelCase_    ,       UpperCamelCase_		)
						return diff, i - start_i







def 	_UpperCamelCase   (    UpperCamelCase_       :					Tuple    ,       UpperCamelCase_       :					Optional[int]    ,       UpperCamelCase_       :					List[str]		)  ->   List[str]:

						"""simple docstring"""



						for j in range(UpperCamelCase_    ,       len(UpperCamelCase_		)		):
												lowerCAmelCase__    						=						digits[j] + addend
												if s >= 10:
																		lowerCAmelCase__						,       lowerCAmelCase__    						=						divmod(UpperCamelCase_    ,       10		)
																		lowerCAmelCase__    						=						addend // 10 + quotient
												else:
																		lowerCAmelCase__    						=						s
																		lowerCAmelCase__    						=						addend // 10

												if addend == 0:
																		break

						while addend > 0:
												lowerCAmelCase__						,       lowerCAmelCase__    						=						divmod(UpperCamelCase_    ,       10		)
												digits.append(UpperCamelCase_		)







def 	_UpperCamelCase   (    UpperCamelCase_       :					int = 10**15		)  ->   int:

						"""simple docstring"""



						lowerCAmelCase__    						=						[1]
						lowerCAmelCase__    						=						1
						lowerCAmelCase__    						=						0
						while True:
												lowerCAmelCase__						,       lowerCAmelCase__    						=						next_term(UpperCamelCase_    ,       20    ,       i + dn    ,       UpperCamelCase_		)
												dn += terms_jumped
												if dn == n - i:
																		break

						lowerCAmelCase__    						=						0
						for j in range(len(UpperCamelCase_		)		):
												a_n += digits[j] * 10**j
						return a_n


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





