#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, char);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ sscanf(char *, char *, char *, char *, char *, char *);
int main(void) {
  char input[14], isbn[10], prev;
  scanf("%s", input);
  sscanf(input, "%c-%3c-%5c-%c", isbn, isbn + 1, isbn + 4, &prev);
  int sum = 0;
  for (int i = 0; i < 9; i++) {
    sum += (i + 1) * (isbn[i] - '0');
  }
  char now = sum % 11;
  now = (now == 10) ? 'X' : now + '0';
  if (now == prev) {
    puts("Right");
  } else {
    input[12] = '\0';
    printf("%s%c\n", input, now);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x12(%rbp),%rsi
lea    0xea6(%rip),%rdi
call   1060 <scanf@plt>
lea    -0x12(%rbp),%rdi
lea    -0x1c(%rbp),%rdx
lea    -0x1c(%rbp),%rcx
add    $0x1,%rcx
lea    -0x1c(%rbp),%r8
add    $0x4,%r8
lea    0xe85(%rip),%rsi
lea    -0x1d(%rbp),%r9
call   1050 <sscanf@plt>
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
cmpl   $0x9,-0x28(%rbp)
jge    11c8 <main+0x88>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
movslq -0x28(%rbp),%rcx
movsbl -0x1c(%rbp,%rcx,1),%ecx
sub    $0x30,%ecx
imul   %ecx,%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1195 <main+0x55>
mov    -0x24(%rbp),%eax
mov    $0xb,%ecx
cltd
idiv   %ecx
mov    %dl,%al
mov    %al,-0x29(%rbp)
movsbl -0x29(%rbp),%eax
cmp    $0xa,%eax
jne    11f2 <main+0xb2>
mov    $0x58,%eax
mov    %eax,-0x30(%rbp)
jmp    11fc <main+0xbc>
movsbl -0x29(%rbp),%eax
add    $0x30,%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    %al,-0x29(%rbp)
movsbl -0x29(%rbp),%eax
movsbl -0x1d(%rbp),%ecx
cmp    %ecx,%eax
jne    1223 <main+0xe3>
lea    0xdf8(%rip),%rdi
call   1030 <puts@plt>
jmp    123b <main+0xfb>
movb   $0x0,-0x6(%rbp)
lea    -0x12(%rbp),%rsi
lea    0xde5(%rip),%rdi
movsbl -0x29(%rbp),%edx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xeb4(%rip),%rdi
lea    0x12(%rsp),%rbx
mov    %rbx,%rsi
call   1060 <scanf@plt>
lea    0x9(%rsp),%rcx
lea    0xc(%rsp),%r8
lea    0xe99(%rip),%rsi
lea    0x8(%rsp),%rdx
lea    0x7(%rsp),%r9
mov    %rbx,%rdi
call   1050 <sscanf@plt>
movsbl 0x8(%rsp),%eax
movsbl 0x9(%rsp),%ecx
lea    (%rax,%rcx,2),%eax
movsbl 0xa(%rsp),%ecx
lea    (%rcx,%rcx,2),%ecx
add    %eax,%ecx
movsbl 0xb(%rsp),%eax
lea    (%rcx,%rax,4),%eax
movsbl 0xc(%rsp),%ecx
lea    (%rcx,%rcx,4),%ecx
add    %eax,%ecx
movsbl 0xd(%rsp),%eax
lea    (%rax,%rax,2),%eax
lea    (%rcx,%rax,2),%eax
movsbl 0xe(%rsp),%ecx
lea    0x0(,%rcx,8),%edx
sub    %ecx,%edx
add    %eax,%edx
movsbl 0xf(%rsp),%eax
lea    (%rdx,%rax,8),%eax
movsbl 0x10(%rsp),%ecx
lea    (%rcx,%rcx,8),%ecx
add    %ecx,%eax
add    $0xfffff790,%eax
cltq
imul   $0x2e8ba2e9,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rcx,%rdx,2),%ecx
sub    %ecx,%eax
lea    0x30(%rax),%ecx
cmp    $0xa,%eax
movzbl %cl,%ecx
mov    $0x58,%eax
cmovne %ecx,%eax
movzbl %al,%ecx
movsbl 0x7(%rsp),%edx
cmp    %edx,%ecx
jne    1220 <main+0xe0>
lea    0xdf8(%rip),%rdi
call   1030 <puts@plt>
jmp    1239 <main+0xf9>
movb   $0x0,0x1e(%rsp)
movsbl %al,%edx
lea    0xde8(%rip),%rdi
lea    0x12(%rsp),%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [14 x i8] c"%c-%3c-%5c-%c\00"
@.str.2 = [6 x i8] c"Right\00"
@.str.3 = [6 x i8] c"%s%c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [14 x i8]
%3 = alloca [10 x i8]
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
store i32 0, i32* %1
%8 = getelementptr inbounds [14 x i8], [14 x i8]* %2, i64 0, i64 0
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = getelementptr inbounds [14 x i8], [14 x i8]* %2, i64 0, i64 0
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%12 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%13 = getelementptr inbounds i8, i8* %12, i64 1
%14 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%15 = getelementptr inbounds i8, i8* %14, i64 4
%16 = call i32 @sscanf(i8* %10, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %11, i8* %13, i8* %15, i8* %4)
store i32 0, i32* %5
store i32 0, i32* %6
br label %17
17: ; preds = %32, %0
%18 = load i32, i32* %6
%19 = icmp slt i32 %18, 9
br i1 %19, label %20, label %35
20: ; preds = %17
%21 = load i32, i32* %6
%22 = add nsw i32 %21, 1
%23 = load i32, i32* %6
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = sub nsw i32 %27, 48
%29 = mul nsw i32 %22, %28
%30 = load i32, i32* %5
%31 = add nsw i32 %30, %29
store i32 %31, i32* %5
br label %32
32: ; preds = %20
%33 = load i32, i32* %6
%34 = add nsw i32 %33, 1
store i32 %34, i32* %6
br label %17
35: ; preds = %17
%36 = load i32, i32* %5
%37 = srem i32 %36, 11
%38 = trunc i32 %37 to i8
store i8 %38, i8* %7
%39 = load i8, i8* %7
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %40, 10
br i1 %41, label %42, label %43
42: ; preds = %35
br label %47
43: ; preds = %35
%44 = load i8, i8* %7
%45 = sext i8 %44 to i32
%46 = add nsw i32 %45, 48
br label %47
47: ; preds = %43, %42
%48 = phi i32 [ 88, %42 ], [ %46, %43 ]
%49 = trunc i32 %48 to i8
store i8 %49, i8* %7
%50 = load i8, i8* %7
%51 = sext i8 %50 to i32
%52 = load i8, i8* %4
%53 = sext i8 %52 to i32
%54 = icmp eq i32 %51, %53
br i1 %54, label %55, label %57
55: ; preds = %47
%56 = call i32 @puts(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %62
57: ; preds = %47
%58 = getelementptr inbounds [14 x i8], [14 x i8]* %2, i64 0, i64 12
store i8 0, i8* %58
%59 = getelementptr inbounds [14 x i8], [14 x i8]* %2, i64 0, i64 0
%60 = load i8, i8* %7
%61 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %59, i8 signext %60)
br label %62
62: ; preds = %57, %55
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [14 x i8] c"%c-%3c-%5c-%c\00"
@.str.2 = [6 x i8] c"Right\00"
@.str.3 = [6 x i8] c"%s%c\0A\00"
define i32 @main() {
%1 = alloca [14 x i8]
%2 = alloca [10 x i8]
%3 = alloca i8
%4 = getelementptr inbounds [14 x i8], [14 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 1
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 4
%9 = call i32 @sscanf(i8* %4, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %5, i8* %7, i8* %8, i8* %3)
%10 = load i8, i8* %5
%11 = sext i8 %10 to i32
%12 = load i8, i8* %7
%13 = sext i8 %12 to i32
%14 = shl nsw i32 %13, 1
%15 = add nsw i32 %14, %11
%16 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 2
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = mul nsw i32 %18, 3
%20 = add nsw i32 %19, %15
%21 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 3
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = shl nsw i32 %23, 2
%25 = add nsw i32 %24, %20
%26 = load i8, i8* %8
%27 = sext i8 %26 to i32
%28 = mul nsw i32 %27, 5
%29 = add nsw i32 %28, %25
%30 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 5
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = mul nsw i32 %32, 6
%34 = add nsw i32 %33, %29
%35 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 6
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = mul nsw i32 %37, 7
%39 = add i32 %38, %34
%40 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 7
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
%43 = shl nsw i32 %42, 3
%44 = add i32 %43, %39
%45 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 8
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = mul nsw i32 %47, 9
%49 = add i32 %48, %44
%50 = add i32 %49, -2160
%51 = srem i32 %50, 11
%52 = icmp eq i32 %51, 10
%53 = trunc i32 %51 to i8
%54 = add nsw i8 %53, 48
%55 = select i1 %52, i8 88, i8 %54
%56 = zext i8 %55 to i32
%57 = load i8, i8* %3
%58 = sext i8 %57 to i32
%59 = icmp eq i32 %56, %58
br i1 %59, label %60, label %62
60: ; preds = %0
%61 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %65
62: ; preds = %0
%63 = getelementptr inbounds [14 x i8], [14 x i8]* %1, i64 0, i64 12
store i8 0, i8* %63
%64 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %4, i8 signext %55)
br label %65
65: ; preds = %62, %60
ret i32 0
}