using System; using System.Linq; using System.Collections.Generic; using System.Text.RegularExpressions; using System.Text; public class Program { public void Proc() { Reader.IsDebug = false; decimal num = decimal.Parse(Reader.ReadLine()); Console.WriteLine(GetMod(1, num-1)); decimal ans = 0; if(num%11>0) { ans = Get101Num(1, (int)(num%11)-1); } Console.WriteLine(ans); } private decimal Get101Num(decimal num, int keta) { if(keta == 0) { return num; } decimal tmp = num; for(int i=1; i<=keta; i++) { tmp = tmp * 100 + 1; } return tmp; } Dictionary dic = new Dictionary(); private decimal GetMod(decimal num, decimal remain) { if(remain <= 5) { decimal num2 = Get101Num(num, (int)remain); return num2%mod1; } if(!dic.ContainsKey(num)) { dic.Add(num,remain); } else { decimal tmp = dic[num] - remain; decimal newRemain = remain % tmp; if(newRemain != remain) { return this.GetMod(num, newRemain); } } decimal target = Get101Num(num, (int)Math.Min(remain, 5)); decimal newR = remain - Math.Min(remain, 5); return this.GetMod(target%mod1, newR); } private decimal mod1 = 1000000007; public class Reader { public static bool IsDebug = true; private static System.IO.StringReader SReader; private static string InitText = @" 101 "; public static string ReadLine() { if(IsDebug) { if(SReader == null) { SReader = new System.IO.StringReader(InitText.Trim()); } return SReader.ReadLine(); } else { return Console.ReadLine(); } } } public static void Main(string[] args) { Program prg = new Program(); prg.Proc(); } }