using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.IO; using System.Text; class Iroha { public Iroha() { } public static int Main() { new Iroha().calc(); return 0; } Scanner cin; long x, y, z; void calc() { cin = new Scanner(); x = cin.nextLong(); y = cin.nextLong(); z = cin.nextLong(); long p = 0, q = 0; if (z == 0) { Console.WriteLine(""); return; } if(x == 0 && y == 0) { Console.WriteLine("mourennaihasimasenn"); return; } if(x == 0) { if(z % y == 0 && z / y < 5001) { StringBuilder tsb = new StringBuilder(); tsb.Append('w'); for (int i = 1; i < z / y; i++) { tsb.Append("wC"); } Console.WriteLine(tsb.ToString()); } else Console.WriteLine("mourennaihasimasenn"); return; } if (y == 0) { if (z % x == 0 && z / x < 5001) { StringBuilder tsb = new StringBuilder(); tsb.Append('c'); for (int i = 1; i < z / x; i++) { tsb.Append("cC"); } Console.WriteLine(tsb.ToString()); } else Console.WriteLine("mourennaihasimasenn"); return; } extgcd(x, y, ref p, ref q); long g = gcd(x, y); if(z % g != 0) { Console.WriteLine("mourennaihasimasenn"); return; } p *= (z / g); q *= (z / g); return; while (Math.Abs(p) + Math.Abs(q) > Math.Abs(p + (y / g) * 10000) + Math.Abs(q - (x / g) * 10000)) { p += (y / g) * 10000; q -= (x / g) * 10000; } while (Math.Abs(p) + Math.Abs(q) > Math.Abs(p - (y / g) * 10000) + Math.Abs(q + (x / g) * 10000)) { p -= (y / g) * 10000; q += (x / g) * 10000; } while (Math.Abs(p) + Math.Abs(q) > Math.Abs(p + y / g) + Math.Abs(q - x / g)) { p += y / g; q -= x / g; } while (Math.Abs(p) + Math.Abs(q) > Math.Abs(p - y / g) + Math.Abs(q + x / g)) { p -= y / g; q += x / g; } StringBuilder sb = new StringBuilder(); int WCount = 0; int firstadd = 0; while (sb.Length <= 10000 && p < 0) { sb.Append('c'); WCount++; p++; } while (sb.Length <= 10000 && q < 0) { sb.Append('w'); WCount++; q++; } while (sb.Length <= 10000 && p > 0) { sb.Append('c'); if (firstadd != 0) { sb.Append('C'); } else firstadd++; p--; } while (sb.Length <= 10000 && q > 0) { sb.Append('w'); if (firstadd != 0) { sb.Append('C'); } else firstadd++; q--; } sb.Append(new string('W', WCount)); if (sb.Length > 10000) Console.WriteLine("mourennaihasimasenn"); else Console.WriteLine(sb.ToString()); } //swap void swap(ref T a, ref T b) { T c = a; a = b; b = c; } long gcd(long a, long b) { return b != 0 ? gcd(b, a % b) : a; } long lcm(long a, long b) { return a * b / gcd(a, b); } // a x + b y = gcd(a, b) long extgcd(long a, long b, ref long x, ref long y) { long g = a; x = 1; y = 0; if (b != 0) { g = extgcd(b, a % b, ref y, ref x); y -= (a / b) * x; } return g; } } class Scanner { string[] s; int i; char[] cs = new char[] { ' ' }; public Scanner() { s = new string[0]; i = 0; } public string next() { if (i < s.Length) return s[i++]; string st = Console.ReadLine(); while (st == "") st = Console.ReadLine(); s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries); i = 0; return next(); } public int nextInt() { return int.Parse(next()); } public long nextLong() { return long.Parse(next()); } public double nextDouble() { return double.Parse(next()); } }