var i,m,n:word;c:char;begin repeat read(m,c,n);i:=m;while m mod i+n mod i>0do i:=i-1;writeln(m div i,copy(c+stringof(n div i),ord(n>i)))until 0>0end.