using System; using System.Collections.Generic; using System.Text; using System.Linq; class Program { public void Proc() { Reader.IsDebug = false; int deskKindCOunt = int.Parse(Reader.ReadLine()); long ans = 1; for(int i=0; i 10) { long mul = long.Parse(subMp.Substring(subMp.Length - 10)); ans *= this.Pow(num, mul); ans = ans % baseNum; ans *= this.Pow(num, 10000000000); ans = ans % baseNum; subMp = subMp.Substring(0, subMp.Length - 10); } ans *= this.Pow(num, long.Parse(subMp)); ans = ans % baseNum; return ans; } private long Pow(long num , long pow) { if(!powerDic.ContainsKey(num)) { powerDic.Add(num, new Dictionary()); } if(powerDic[num].ContainsKey(pow)) { return powerDic[num][pow]; } long ans = 1; if(pow == 0) { return 1; } if(pow == 1) { return num; } if(pow == 2) { return (num * num) % baseNum; } long subPow = pow / 2; ans *= this.Pow(num, subPow); ans *= this.Pow(num, pow - subPow); ans = ans % baseNum; powerDic[num].Add(pow, ans); return ans; } private long GetKumiawase(long remainIsu) { if(dic.ContainsKey(remainIsu)) { return dic[remainIsu]; } if(remainIsu == 1) { return 2; } if(remainIsu == 0) { return 0; } long ret1 = this.GetKumiawase(remainIsu - 1); long ret2 = 0; if(remainIsu == 2) { ret2 += 1; } else if(remainIsu > 2) { ret2 = this.GetKumiawase(remainIsu - 2); } long ans = (ret1 + ret2) % baseNum; dic.Add(remainIsu, ans); return ans; } private Dictionary> powerDic = new Dictionary>(); private long baseNum = 1000000000 + 7; private Dictionary dic = new Dictionary(); public class Reader { public static bool IsDebug = true; private static String PlainInput = @" 3 10 10 20 20 30 30 "; private static System.IO.StringReader Sr = null; public static string ReadLine() { if (IsDebug) { if (Sr == null) { Sr = new System.IO.StringReader(PlainInput.Trim()); } return Sr.ReadLine(); } else { return Console.ReadLine(); } } public static int[] GetInt(char delimiter = ' ', bool trim = false) { string inptStr = ReadLine(); if (trim) { inptStr = inptStr.Trim(); } string[] inpt = inptStr.Split(delimiter); int[] ret = new int[inpt.Length]; for (int i = 0; i < inpt.Length; i++) { ret[i] = int.Parse(inpt[i]); } return ret; } } static void Main() { Program prg = new Program(); prg.Proc(); } }