/* -*- coding: utf-8 -*- * * 1177.cc: No.1177 余りは? - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ const int MOD = 1000000007; /* typedef */ typedef long long ll; /* global variables */ /* subroutines */ /* main */ int main() { int p, k; scanf("%d%d", &p, &k); int q = 0, r = 1; for (int i = 1; i < p; i++) { int d = r * 10; q = ((ll)q * 10 + d / p) % MOD; r = d % p; } //printf("q=%d, r=%d\n", q, r); if (r >= k) q = (q + 1) % MOD; printf("%d\n", q); return 0; }