n = gets.to_i MOD = 1000000007 def power_mod(num, power) prod = 1 num %= MOD while power > 0 do if power & 1 == 1 prod = (prod * num) % MOD end num = (num * num) % MOD power >>= 1 end return prod end ans = power_mod(10, n) base = 1 digit = 1 result = 3 while n > 0 if n%2 == 1 ans = (ans + base * result) % MOD base = base * power_mod(10, digit) % MOD end result = result * (1 + power_mod(10, digit)) % MOD digit *= 2 n /= 2 end puts ans