import java.math.BigInteger;

public class Euler813 {

    static final long MOD = 1000000007L;

    static long modPow(long base, long exp) {
        long res = 1;
        base %= MOD;
        while (exp > 0) {
            if ((exp & 1L) == 1L) {
                res = (res * base) % MOD;
            }
            base = (base * base) % MOD;
            exp >>= 1L;
        }
        return res;
    }

    static BigInteger clmul(BigInteger a, BigInteger b) {
        BigInteger res = BigInteger.ZERO;
        int shift = 0;
        while (a.signum() > 0) {
            int tz = a.getLowestSetBit();
            shift += tz;
            a = a.shiftRight(tz);
            res = res.xor(b.shiftLeft(shift));
            a = a.shiftRight(1);
            shift++;
        }
        return res;
    }

    static BigInteger clpow(BigInteger base, long exp) {
        BigInteger res = BigInteger.ONE;
        while (exp > 0) {
            if ((exp & 1L) == 1L) {
                res = clmul(res, base);
            }
            exp >>= 1L;
            if (exp > 0) {
                base = clmul(base, base);
            }
        }
        return res;
    }

    static long evalPolyMod(BigInteger polyBits, long xMod) {
        if (polyBits.signum() == 0)
            return 0;
        int deg = polyBits.bitLength() - 1;
        long ans = 0;
        for (int i = deg; i >= 0; i--) {
            ans = (ans * xMod) % MOD;
            if (polyBits.testBit(i)) {
                ans++;
                if (ans == MOD) {
                    ans = 0;
                }
            }
        }
        return ans;
    }

    public static String solve() {
        long threePow8 = 6561L;
        long twoPow52 = 1L << 52;

        BigInteger f = BigInteger.valueOf(11);
        BigInteger g = clpow(f, threePow8);

        long x = modPow(2, twoPow52);
        long ans = evalPolyMod(g, x);

        return Long.toString(ans);
    }

    public static void main(String[] args) {
        System.out.println(solve());
    }
}
