using System; using System.IO; using System.Linq; using System.Collections.Generic; using System.Text; public class Program { public void Proc() { long num = long.Parse(Reader.ReadLine()); long num1 = num; long num2 = 0; for (long i = 0; i <= num; i++) { if(num1.ToString().Any(a=>a=='7') || num2.ToString().Any(a=>a=='7') ) { } else { break; } int keta = 0; if(num1.ToString().IndexOf('7')>=0) { keta = num1.ToString().Length - num1.ToString().IndexOf('7'); } else { keta = num2.ToString().Length - num2.ToString().IndexOf('7'); } num1 -= int.Parse("1".PadRight(keta)); num2 = num - num1; } Console.WriteLine(num1 + " " + num2); } 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 = @" 17 "; } public static void Main(string[] args) { #if DEBUG Reader.IsDebug = true; #endif Program prg = new Program(); prg.Proc(); } }