#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 *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int t1 = 0, t2 = 0, s = 0, p = 0, i = 0;
  scanf("%d", &p);
  for (i; i < p; i++) {
    scanf("%d", &t2);
    if (i != 0)
      if (t2 - t1 >= 10)
        s += 10;
      else
        s += t2 - t1;
    t1 = t2;
  }
  s += 10;
  printf("%d", s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xea7(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11ca <main+0xaa>
lea    0xe8b(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x18(%rbp)
je     11b6 <main+0x96>
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
cmp    $0xa,%eax
jl     11a5 <main+0x85>
mov    -0x10(%rbp),%eax
add    $0xa,%eax
mov    %eax,-0x10(%rbp)
jmp    11b1 <main+0x91>
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    11b6 <main+0x96>
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1162 <main+0x42>
mov    -0x10(%rbp),%eax
add    $0xa,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe23(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
movl   $0x0,(%rsp)
lea    0xebf(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
mov    $0xa,%r13d
cmpl   $0x0,(%rsp)
jle    11bb <main+0x9b>
lea    0xea4(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
cmpl   $0x2,(%rsp)
jl     11bb <main+0x9b>
xor    %r13d,%r13d
mov    $0x1,%ebp
mov    0x4(%rsp),%ebx
lea    0xe81(%rip),%r14
lea    0x4(%rsp),%r15
mov    $0xa,%r12d
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
mov    %eax,%ecx
sub    %ebx,%ecx
cmp    $0xa,%ecx
cmovge %r12d,%ecx
add    %ecx,%r13d
add    $0x1,%ebp
mov    %eax,%ebx
cmp    (%rsp),%ebp
jl     1190 <main+0x70>
add    $0xa,%r13d
lea    0xe3e(%rip),%rdi
mov    %r13d,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%8 = load i32, i32* %6
br label %9
9: ; preds = %34, %0
%10 = load i32, i32* %6
%11 = load i32, i32* %5
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %37
13: ; preds = %9
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%15 = load i32, i32* %6
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %32
17: ; preds = %13
%18 = load i32, i32* %3
%19 = load i32, i32* %2
%20 = sub nsw i32 %18, %19
%21 = icmp sge i32 %20, 10
br i1 %21, label %22, label %25
22: ; preds = %17
%23 = load i32, i32* %4
%24 = add nsw i32 %23, 10
store i32 %24, i32* %4
br label %31
25: ; preds = %17
%26 = load i32, i32* %3
%27 = load i32, i32* %2
%28 = sub nsw i32 %26, %27
%29 = load i32, i32* %4
%30 = add nsw i32 %29, %28
store i32 %30, i32* %4
br label %31
31: ; preds = %25, %22
br label %32
32: ; preds = %31, %13
%33 = load i32, i32* %3
store i32 %33, i32* %2
br label %34
34: ; preds = %32
%35 = load i32, i32* %6
%36 = add nsw i32 %35, 1
store i32 %36, i32* %6
br label %9
37: ; preds = %9
%38 = load i32, i32* %4
%39 = add nsw i32 %38, 10
store i32 %39, i32* %4
%40 = load i32, i32* %4
%41 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %40)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %29
8: ; preds = %0
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%10 = load i32, i32* %2
%11 = icmp sgt i32 %10, 1
br i1 %11, label %12, label %29
12: ; preds = %8
%13 = load i32, i32* %1
br label %14
14: ; preds = %12, %14
%15 = phi i32 [ %24, %14 ], [ 1, %12 ]
%16 = phi i32 [ %23, %14 ], [ 0, %12 ]
%17 = phi i32 [ %19, %14 ], [ %13, %12 ]
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%19 = load i32, i32* %1
%20 = sub nsw i32 %19, %17
%21 = icmp slt i32 %20, 10
%22 = select i1 %21, i32 %20, i32 10
%23 = add nsw i32 %16, %22
%24 = add nuw nsw i32 %15, 1
%25 = load i32, i32* %2
%26 = icmp slt i32 %24, %25
br i1 %26, label %14, label %27
27: ; preds = %14
%28 = add i32 %23, 10
br label %29
29: ; preds = %27, %8, %0
%30 = phi i32 [ 10, %0 ], [ 10, %8 ], [ %28, %27 ]
%31 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %30)
ret i32 0
}