#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 /*<<< orphan*/ scanf(char *, int *, int *, int *);
int main() {
  int d1;
  int m1;
  int y1;
  scanf("%d %d %d", &d1, &m1, &y1);
  int d2;
  int m2;
  int y2;
  scanf("%d %d %d", &d2, &m2, &y2);
  if (y1 == y2) {
    if (m1 == m2) {
      if (d1 <= d2) {
        printf("0");
      } else {
        printf("%d\n", 15 * (d1 - d2));
      }
    } else {
      if (m1 <= m2) {
        printf("0");
      } else {
        printf("%d\n", 500 * (m1 - m2));
      }
    }
  } else {
    if (y1 < y2) {
      printf("0");
    } else {
      printf("10000");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1040 <scanf@plt>
lea    0xeb2(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x1c(%rbp),%rcx
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jne    11f5 <main+0xd5>
mov    -0xc(%rbp),%eax
cmp    -0x18(%rbp),%eax
jne    11b2 <main+0x92>
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     1196 <main+0x76>
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ad <main+0x8d>
mov    -0x8(%rbp),%eax
sub    -0x14(%rbp),%eax
imul   $0xf,%eax,%esi
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f0 <main+0xd0>
mov    -0xc(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     11d1 <main+0xb1>
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11eb <main+0xcb>
mov    -0xc(%rbp),%eax
sub    -0x18(%rbp),%eax
imul   $0x1f4,%eax,%esi
lea    0xe25(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f0 <main+0xd0>
jmp    1227 <main+0x107>
mov    -0x10(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1214 <main+0xf4>
lea    0xe09(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1222 <main+0x102>
lea    0xdf2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1227 <main+0x107>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xec4(%rip),%rbx
lea    0x1c(%rsp),%rsi
lea    0x18(%rsp),%rdx
lea    0x14(%rsp),%rcx
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0x8(%rsp),%eax
cmp    %eax,0x14(%rsp)
jne    1190 <main+0x60>
mov    0x18(%rsp),%eax
sub    0xc(%rsp),%eax
jne    11a2 <main+0x72>
mov    0x1c(%rsp),%eax
sub    0x10(%rsp),%eax
jle    11ba <main+0x8a>
lea    (%rax,%rax,4),%eax
lea    (%rax,%rax,2),%esi
jmp    11aa <main+0x7a>
jl     11ba <main+0x8a>
lea    0xe74(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11c4 <main+0x94>
jle    11ba <main+0x8a>
imul   $0x1f4,%eax,%esi
lea    0xe58(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11c4 <main+0x94>
mov    $0x30,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [9 x i8] c"%d %d %d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@.str.3 = [6 x i8] c"10000\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = bitcast i32* %1 to i8*
%8 = bitcast i32* %2 to i8*
%9 = bitcast i32* %3 to i8*
%10 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%11 = bitcast i32* %4 to i8*
%12 = bitcast i32* %5 to i8*
%13 = bitcast i32* %6 to i8*
%14 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %4, i32* %5, i32* %6)
%15 = load i32, i32* %3
%16 = load i32, i32* %6
%17 = icmp eq i32 %15, %16
br i1 %17, label %18, label %40
18: ; preds = %0
%19 = load i32, i32* %2
%20 = load i32, i32* %5
%21 = icmp eq i32 %19, %20
br i1 %21, label %22, label %32
22: ; preds = %18
%23 = load i32, i32* %1
%24 = load i32, i32* %4
%25 = icmp sgt i32 %23, %24
br i1 %25, label %28, label %26
26: ; preds = %22
%27 = call i32 @putchar(i32 48)
br label %46
28: ; preds = %22
%29 = sub nsw i32 %23, %24
%30 = mul nsw i32 %29, 15
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %30)
br label %46
32: ; preds = %18
%33 = icmp sgt i32 %19, %20
br i1 %33, label %36, label %34
34: ; preds = %32
%35 = call i32 @putchar(i32 48)
br label %46
36: ; preds = %32
%37 = sub nsw i32 %19, %20
%38 = mul nsw i32 %37, 500
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %38)
br label %46
40: ; preds = %0
%41 = icmp slt i32 %15, %16
br i1 %41, label %42, label %44
42: ; preds = %40
%43 = call i32 @putchar(i32 48)
br label %46
44: ; preds = %40
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %46
46: ; preds = %42, %44, %28, %26, %36, %34
ret i32 0
}