using System; using System.IO; using System.Linq; using System.Collections.Generic; public class Program { public void Proc() { int num = int.Parse(Reader.ReadLine()); long ans = GetAns(num, 0); Console.WriteLine(ans); } private long mod = 1000000000 + 7; private Dictionary> dic = new Dictionary>(); private long GetAns(long green, long yellow) { if(green == 0 && yellow == 0) { return 1; } if(!dic.ContainsKey(green)) { dic.Add(green, new Dictionary()); } if(dic[green].ContainsKey(yellow)) { return dic[green][yellow]; } long ans = 0; if(green == 0) { ans = 1; for(int i=2; i<=yellow; i++) { ans=ans*i; } } else { if(green > 0) { ans = GetAns(green - 1, yellow + 1) * green; ans = ans % mod; } if(yellow > 0) { ans += (GetAns(green, yellow - 1) * yellow); ans = ans % mod; } } dic[green][yellow] = ans; return ans; } public class Reader { private static StringReader sr; public static bool IsDebug = false; public static string ReadLine() { if (IsDebug) { if (sr == null) { sr = new StringReader(InputText.Trim()); } return sr.ReadLine(); } else { return Console.ReadLine(); } } private static string InputText = @" 2 "; } public static void Main(string[] args) { #if DEBUG Reader.IsDebug = true; #endif Program prg = new Program(); prg.Proc(); } }