#include using namespace std; #ifdef _RUTHEN #include "debug.hpp" #else #define show(...) true #endif using ll = long long; #define rep(i, n) for (int i = 0; i < (n); i++) template using V = vector; #include using mint = atcoder::modint1000000007; using mint2 = atcoder::modint; ostream &operator<<(ostream &os, const mint &p) { return os << p.val(); } int main() { ios::sync_with_stdio(false); cin.tie(0); mint2::set_mod(7); int K; cin >> K; V D(K), L(K); rep(i, K) cin >> D[i] >> L[i]; V dp(7, 0); dp[0] = 1; rep(i, K) { V np = dp; mint2 v = 10, p = 10; v = v.pow(L[i]); p = p.pow(L[i]); v--; v /= 9; v *= D[i]; rep(j, 7) np[(j * p + v).val()] += dp[j]; dp = np; } mint ans = 0; rep(j, 7) ans += dp[j] * j; cout << ans.val() << '\n'; return 0; }