shendu2 =input() shendu=int(shendu2) MOD=10**9+7 if shendu==1: print(0) else: ZHILI=pow(2,shendu-1,MOD) BABA=3*ZHILI-5 daan=BABA%MOD print(daan)