#P8140. [ICPC 2020 WF] Trailing Digits

[ICPC 2020 WF] Trailing Digits

Description

有一批货,每个价值 bb 元,可以把 nn 个货打包出售,价格是 b×nb \times n 元(前提是b×nab \times n\le a),使末尾含有尽可能多的数字 dd ,求最多的 dd 数量。

Input Format

一行三个整数,bb , ddaa

Output Format

一个整数,最多的 dd 数量。

57 9 1000
2
57 4 40000
3
57 4 39000
2

Hint

对于全部数据,有 1b<1061 \le b < 10^6 , 0d90 \le d \le 9 , ba<1010000b \le a < 10^{10000}