#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 main() {
  int p;
  int min;
  scanf("%d%d", &p, &min);
  if (p >= 1000000 && p <= 9999999) {
    printf("%d$\n", min);
  } else if (p >= 100 && p <= 999 && p != 101 && p != 102 && p != 103 &&
             p != 104 && p != 112) {
    printf("%d$\n", min * 40);
  } else if (p == 101 || p == 102 || p == 103 || p == 104 || p == 112) {
    printf("0$\n");
  } else {
    printf("-1\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
cmpl   $0xf4240,-0x8(%rbp)
jl     1173 <main+0x53>
cmpl   $0x98967f,-0x8(%rbp)
jg     1173 <main+0x53>
mov    -0xc(%rbp),%esi
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1230 <main+0x110>
cmpl   $0x64,-0x8(%rbp)
jl     11d3 <main+0xb3>
cmpl   $0x3e7,-0x8(%rbp)
jg     11d3 <main+0xb3>
cmpl   $0x65,-0x8(%rbp)
je     11d3 <main+0xb3>
cmpl   $0x66,-0x8(%rbp)
je     11d3 <main+0xb3>
cmpl   $0x67,-0x8(%rbp)
je     11d3 <main+0xb3>
cmpl   $0x68,-0x8(%rbp)
je     11d3 <main+0xb3>
cmpl   $0x70,-0x8(%rbp)
je     11d3 <main+0xb3>
imul   $0x28,-0xc(%rbp),%esi
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122b <main+0x10b>
cmpl   $0x65,-0x8(%rbp)
je     1205 <main+0xe5>
cmpl   $0x66,-0x8(%rbp)
je     1205 <main+0xe5>
cmpl   $0x67,-0x8(%rbp)
je     1205 <main+0xe5>
cmpl   $0x68,-0x8(%rbp)
je     1205 <main+0xe5>
cmpl   $0x70,-0x8(%rbp)
jne    1218 <main+0xf8>
lea    0xdfe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1226 <main+0x106>
lea    0xdef(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122b <main+0x10b>
jmp    1230 <main+0x110>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
lea    -0xf4240(%rax),%ecx
cmp    $0x89543f,%ecx
ja     116a <main+0x3a>
mov    (%rsp),%esi
lea    0xea4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1192 <main+0x62>
lea    -0x64(%rax),%ecx
cmp    $0x383,%ecx
ja     1186 <main+0x56>
lea    -0x65(%rax),%ecx
cmp    $0x4,%ecx
jae    1196 <main+0x66>
lea    0xe89(%rip),%rdi
jmp    118d <main+0x5d>
lea    0xe7d(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret
cmp    $0x70,%eax
je     117d <main+0x4d>
mov    (%rsp),%eax
shl    $0x3,%eax
lea    (%rax,%rax,4),%esi
jmp    115a <main+0x2a>

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

LLVM IR (-O2):
@.str = [5 x i8] c"%d%d\00"
@.str.1 = [5 x i8] c"%d$\0A\00"
@str = [3 x i8] c"-1\00"
@str.4 = [3 x i8] c"0$\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = add i32 %6, -1000000
%8 = icmp ult i32 %7, 9000000
br i1 %8, label %9, label %12
9: ; preds = %0
%10 = load i32, i32* %2
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %10)
br label %25
12: ; preds = %0
%13 = freeze i32 %6
%14 = add i32 %13, -100
%15 = icmp ult i32 %14, 900
br i1 %15, label %16, label %23
16: ; preds = %12
switch i32 %13, label %17 [
i32 112, label %21
i32 104, label %21
i32 103, label %21
i32 102, label %21
i32 101, label %21
]
17: ; preds = %16
%18 = load i32, i32* %2
%19 = mul nsw i32 %18, 40
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %19)
br label %25
21: ; preds = %16, %16, %16, %16, %16
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.4, i64 0, i64 0))
br label %25
23: ; preds = %12
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
br label %25
25: ; preds = %17, %23, %21, %9
ret i32 0
}