import java.util.Scanner;
public class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String sa = sc.next();
String[] sx = sa.split("-");
int a, b, c, d;
a = Integer.parseInt(sx[0]);
b = Integer.parseInt(sx[1]);
c = Integer.parseInt(sx[2]);
if (sx[3].equals("X")) {
d = 10;
} else {
d = Integer.parseInt(sx[3]);
}
int index;
index = (a + (b / 100) * 2 + ((b / 10) % 10) * 3 + (b % 10) * 4 + ((c / 10000) * 5) + ((c / 1000) % 10) * 6
+ ((c / 100) % 10) * 7 + ((c / 10) % 10) * 8 + (c % 10) * 9) % 11;
if (d == index) {
System.out.println("Right");
} else if (index < 10) {
System.out.println(sx[0] + "-" + sx[1] + "-" + sx[2] + "-" + index);
} else {
System.out.println(sx[0] + "-" + sx[1] + "-" + sx[2] + "-" + "X");
}
}
}