#include int main() { using namespace std; long n, r; long a = 1000000007; cin >> n; r = 1; for (long i = 0; i < n; i++) { r = (r % a * 10 + 3) % a; } cout << r << endl; }