public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         int a = fs.NextInt();
         string s1 = fs.NextToken();
         string s2 = new string(fs.ReadLine().Reverse().ToArray());
         long c = 0;
         for (int i = 0; i < s2.Length; i++)
         {
             if (s2[i] != '0') c += (long)Math.Pow(a, i) * SingleDigitToDecimalBase(s2[i]);
         }
         if (s1 == "R")
         {
             writer.WriteLine(ToRomanNumeral(c.ToString(), 0));
         }
         else
         {
             int b = Convert.ToInt32(s1);
             writer.WriteLine(DecimalToAnyBase(c, b));
         }
     }
 }