n = int(input())
aaa = [1]
aat = [1]
aac = [1]
aag = [1]
ata = [1]
att = [1]
atc = [1]
atg = [1]
aca = [1]
act = [1]
acc = [1]
aga = [1]
agt = [1]
agg = [1]
taa = [1]
tat = [1]
tac = [1]
tag = [1]
tta = [1]
ttt = [1]
ttc = [1]
ttg = [1]
tca = [1]
tct = [1]
tcc = [1]
tcg = [1]
tga = [1]
tgt = [1]
tgc = [1]
tgg = [1]
caa = [1]
cat = [1]
cac = [1]
cag = [1]
cta = [1]
ctt = [1]
ctc = [1]
ctg = [1]
cca = [1]
cct = [1]
ccc = [1]
ccg = [1]
cga = [1]
cgt = [1]
cgc = [1]
cgg = [1]
gaa = [1]
gat = [1]
gag = [1]
gta = [1]
gtt = [1]
gtc = [1]
gtg = [1]
gca = [1]
gct = [1]
gcc = [1]
gcg = [1]
gga = [1]
ggt = [1]
ggc = [1]
ggg = [1]
for i in range(n-3):
    aaa.append((aaa[i]+taa[i]+caa[i]+gaa[i])%(10**9+7))
    aat.append((aaa[i]+taa[i]+caa[i]+gaa[i])%(10**9+7))
    aac.append((aaa[i]+taa[i]+caa[i]+gaa[i])%(10**9+7))
    aag.append((aaa[i]+taa[i]+caa[i]+gaa[i])%(10**9+7))
    ata.append((aat[i]+tat[i]+cat[i]+gat[i])%(10**9+7))
    att.append((aat[i]+tat[i]+cat[i]+gat[i])%(10**9+7))
    atc.append((aat[i]+tat[i]+cat[i]+gat[i])%(10**9+7))
    atg.append((aat[i]+tat[i]+cat[i]+gat[i])%(10**9+7))
    aca.append((aac[i]+tac[i]+cac[i])%(10**9+7))    
    act.append((aac[i]+tac[i]+cac[i])%(10**9+7))   
    acc.append((aac[i]+tac[i]+cac[i])%(10**9+7))   
    aga.append((aag[i]+tag[i]+cag[i]+gag[i])%(10**9+7)) 
    agt.append((aag[i]+tag[i]+cag[i]+gag[i])%(10**9+7)) 
    agg.append((aag[i]+tag[i]+cag[i]+gag[i])%(10**9+7))
    taa.append((ata[i]+tta[i]+cta[i]+gta[i])%(10**9+7)) 
    tat.append((ata[i]+tta[i]+cta[i]+gta[i])%(10**9+7)) 
    tac.append((ata[i]+tta[i]+cta[i]+gta[i])%(10**9+7))
    tag.append((ata[i]+tta[i]+cta[i]+gta[i])%(10**9+7)) 
    tta.append((att[i]+ttt[i]+ctt[i]+gtt[i])%(10**9+7))
    ttt.append((att[i]+ttt[i]+ctt[i]+gtt[i])%(10**9+7))
    ttc.append((att[i]+ttt[i]+ctt[i]+gtt[i])%(10**9+7))
    ttg.append((att[i]+ttt[i]+ctt[i]+gtt[i])%(10**9+7)) 
    tca.append((atc[i]+ttc[i]+ctc[i]+gtc[i])%(10**9+7))
    tct.append((atc[i]+ttc[i]+ctc[i]+gtc[i])%(10**9+7))
    tcc.append((atc[i]+ttc[i]+ctc[i]+gtc[i])%(10**9+7))
    tcg.append((atc[i]+ttc[i]+ctc[i]+gtc[i])%(10**9+7)) 
    tga.append((atg[i]+ttg[i]+ctg[i]+gtg[i])%(10**9+7))
    tgt.append((atg[i]+ttg[i]+ctg[i]+gtg[i])%(10**9+7))
    tgc.append((ttg[i]+ctg[i]+gtg[i])%(10**9+7))
    tgg.append((atg[i]+ttg[i]+ctg[i]+gtg[i])%(10**9+7)) 
    caa.append((aca[i]+tca[i]+cca[i]+gca[i])%(10**9+7))
    cat.append((aca[i]+tca[i]+cca[i]+gca[i])%(10**9+7))
    cac.append((aca[i]+tca[i]+cca[i]+gca[i])%(10**9+7))
    cag.append((aca[i]+tca[i]+cca[i]+gca[i])%(10**9+7))
    cta.append((act[i]+tct[i]+cct[i]+gct[i])%(10**9+7))
    ctt.append((act[i]+tct[i]+cct[i]+gct[i])%(10**9+7))
    ctc.append((act[i]+tct[i]+cct[i]+gct[i])%(10**9+7))
    ctg.append((act[i]+tct[i]+cct[i]+gct[i])%(10**9+7))
    cca.append((acc[i]+tcc[i]+ccc[i]+gcc[i])%(10**9+7))
    cct.append((acc[i]+tcc[i]+ccc[i]+gcc[i])%(10**9+7))
    ccc.append((acc[i]+tcc[i]+ccc[i]+gcc[i])%(10**9+7))
    ccg.append((acc[i]+tcc[i]+ccc[i]+gcc[i])%(10**9+7))
    cga.append((tcg[i]+ccg[i]+gcg[i])%(10**9+7))
    cgt.append((tcg[i]+ccg[i]+gcg[i])%(10**9+7))
    cgc.append((tcg[i]+ccg[i]+gcg[i])%(10**9+7))
    cgg.append((tcg[i]+ccg[i]+gcg[i])%(10**9+7))
    gaa.append((aga[i]+tga[i]+cga[i]+gga[i])%(10**9+7))
    gat.append((aga[i]+tga[i]+cga[i]+gga[i])%(10**9+7))
    gag.append((aga[i]+tga[i]+cga[i]+gga[i])%(10**9+7))
    gta.append((agt[i]+tgt[i]+cgt[i]+ggt[i])%(10**9+7))
    gtt.append((agt[i]+tgt[i]+cgt[i]+ggt[i])%(10**9+7))
    gtc.append((tgt[i]+cgt[i]+ggt[i])%(10**9+7))
    gtg.append((agt[i]+tgt[i]+cgt[i]+ggt[i])%(10**9+7))
    gca.append((tgc[i]+cgc[i]+ggc[i])%(10**9+7))
    gct.append((tgc[i]+cgc[i]+ggc[i])%(10**9+7))
    gcc.append((tgc[i]+cgc[i]+ggc[i])%(10**9+7))
    gcg.append((tgc[i]+cgc[i]+ggc[i])%(10**9+7))
    gga.append((agg[i]+tgg[i]+cgg[i]+ggg[i])%(10**9+7))
    ggt.append((agg[i]+tgg[i]+cgg[i]+ggg[i])%(10**9+7))
    ggc.append((tgg[i]+cgg[i]+ggg[i])%(10**9+7))
    ggg.append((agg[i]+tgg[i]+cgg[i]+ggg[i])%(10**9+7))
print((aaa[-1]+aat[-1]+aac[-1]+aag[-1]+ata[-1]+att[-1]+atc[-1]+atg[-1]+aca[-1]+act[-1]
      +acc[-1]+aga[-1]+agt[-1]+agg[-1]+taa[-1]+tat[-1]+tac[-1]+tag[-1]+tta[-1]+ttt[-1]
      +ttc[-1]+ttg[-1]+tca[-1]+tct[-1]+tcc[-1]+tcg[-1]+tga[-1]+tgt[-1]+tgc[-1]+tgg[-1]
      +caa[-1]+cat[-1]+cac[-1]+cag[-1]+cta[-1]+ctt[-1]+ctc[-1]+ctg[-1]+cca[-1]+cct[-1]
      +ccc[-1]+ccg[-1]+cga[-1]+cgt[-1]+cgc[-1]+cgg[-1]+gaa[-1]+gat[-1]+gag[-1]+gta[-1]
      +gtt[-1]+gtc[-1]+gtg[-1]+gca[-1]+gct[-1]+gcc[-1]+gcg[-1]+gga[-1]+ggt[-1]+ggc[-1]+ggg[-1])%(10**9+7))


Measured memory_bytes: 3832