#include #include #include #include #include #include #include #include using namespace std; #define GET_ARG(a,b,c,F,...) F #define REP3(i,s,e) for (i = s; i <= e; i++) #define REP2(i,n) REP3 (i,0,(int)(n)-1) #define REP(...) GET_ARG (__VA_ARGS__,REP3,REP2) (__VA_ARGS__) #define RREP3(i,s,e) for (i = s; i >= e; i--) #define RREP2(i,n) RREP3 (i,(int)(n)-1,0) #define RREP(...) GET_ARG (__VA_ARGS__,RREP3,RREP2) (__VA_ARGS__) #define DEBUG(x) cerr << #x ": " << x << endl int gcd(int a, int b) { return b == 0 ? a : gcd(b,a%b); } int extgcd(int a, int b, int& x, int& y) { int d = a; if (b != 0) { d = extgcd(b,a%b,y,x); y -= a/b*x; } else { x = 1; y = 0; } return d; } int main(void) { int x, y, z; char c = 'c', w = 'w'; cin >> x >> y >> z; if (z % gcd(x,y) != 0) { cout << "mourennaihasimasen" << endl; return 0; } if (x < y) { swap(x,y); swap(c,w); } string ans = "ccW"; while (z >= x) { ans += c; ans += 'C'; z -= x; if (ans.size() > 10000) { cout << "mourennaihasimasen" << endl; return 0; } } while (z >= y) { ans += w; ans += 'C'; z -= y; if (ans.size() > 10000) { cout << "mourennaihasimasen" << endl; return 0; } } int a, b; int d = extgcd(x,y,a,b); string str; while (a > 0) { str += c; str += 'C'; a--; } while (a < 0) { str += c; str += 'W'; a++; } while (b > 0) { str += w; str += 'C'; b--; } while (b < 0) { str += w; str += 'W'; b++; } if (ans.size() + z / d * str.size() > 10000) { cout << "mourennaihasimasen" << endl; return 0; } while (z > 0) { ans += str; z -= d; } cout << ans << endl; return 0; }