#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*/ getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, ...);
scalar_t__ strcasecmp(char *, char *);
int strlen(char *);
int main() {
  int len, n;
  char a[10000];
  scanf("%d", &n);
  getchar();
  while (n--) {
    scanf("%s", a);
    len = strlen(a);
    if (strcasecmp(a, "1") == 0 || strcasecmp(a, "4") == 0 ||
        strcasecmp(a, "78") == 0)
      printf("+\n");
    else if (a[len - 1] == '5' && a[len - 2] == '3')
      printf("-\n");
    else if (a[0] == '1' && a[1] == '9' && a[2] == '0')
      printf("?\n");
    else if (a[0] == '9' && a[len - 1] == '4')
      printf("*\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2720,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe97(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
je     12e8 <main+0x198>
lea    -0x2720(%rbp),%rsi
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    -0x2720(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x8(%rbp)
lea    -0x2720(%rbp),%rdi
lea    0xe45(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     120a <main+0xba>
lea    -0x2720(%rbp),%rdi
lea    0xe2a(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     120a <main+0xba>
lea    -0x2720(%rbp),%rdi
lea    0xe0f(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    121b <main+0xcb>
lea    0xdfc(%rip),%rdi
call   1050 <printf@plt>
jmp    12e3 <main+0x193>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x2720(%rbp,%rax,1),%eax
ff
cmp    $0x35,%eax
jne    125e <main+0x10e>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
cltq
movsbl -0x2720(%rbp,%rax,1),%eax
ff
cmp    $0x33,%eax
jne    125e <main+0x10e>
lea    0xdbc(%rip),%rdi
call   1050 <printf@plt>
jmp    12de <main+0x18e>
movsbl -0x2720(%rbp),%eax
cmp    $0x31,%eax
jne    129f <main+0x14f>
movsbl -0x271f(%rbp),%eax
cmp    $0x39,%eax
jne    129f <main+0x14f>
movsbl -0x271e(%rbp),%eax
cmp    $0x30,%eax
jne    129f <main+0x14f>
lea    0xd7e(%rip),%rdi
call   1050 <printf@plt>
jmp    12d9 <main+0x189>
movsbl -0x2720(%rbp),%eax
cmp    $0x39,%eax
jne    12d4 <main+0x184>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x2720(%rbp,%rax,1),%eax
ff
cmp    $0x34,%eax
jne    12d4 <main+0x184>
lea    0xd47(%rip),%rdi
call   1050 <printf@plt>
jmp    12d9 <main+0x189>
jmp    12de <main+0x18e>
jmp    12e3 <main+0x193>
jmp    117b <main+0x2b>
xor    %eax,%eax
add    $0x2720,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2728,%rsp
lea    0xe98(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
subl   $0x1,0xc(%rsp)
jb     1260 <main+0x110>
lea    0xe76(%rip),%r14
lea    0x10(%rsp),%rbx
lea    0xe6d(%rip),%r15
lea    0xe73(%rip),%r13
lea    0xe61(%rip),%r12
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <strcasecmp@plt>
mov    %r13,%rdi
test   %rax,%rax
je     1250 <main+0x100>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1030 <strcasecmp@plt>
mov    %r13,%rdi
test   %rax,%rax
je     1250 <main+0x100>
mov    %rbx,%rdi
lea    0xe13(%rip),%rsi
call   1030 <strcasecmp@plt>
mov    %r13,%rdi
test   %rax,%rax
je     1250 <main+0x100>
movslq %ebp,%rcx
movzbl -0x1(%rcx,%rbx,1),%eax
cmp    $0x35,%al
jne    121e <main+0xce>
cmpb   $0x33,-0x2(%rcx,%rbx,1)
lea    0xdf5(%rip),%rdi
je     1250 <main+0x100>
movzbl 0x10(%rsp),%ecx
cmp    $0x31,%cl
jne    123d <main+0xed>
cmpb   $0x39,0x11(%rsp)
jne    123d <main+0xed>
cmpb   $0x30,0x12(%rsp)
lea    0xdd4(%rip),%rdi
je     1250 <main+0x100>
cmp    $0x39,%cl
jne    1255 <main+0x105>
lea    0xdc4(%rip),%rdi
cmp    $0x34,%al
jne    1255 <main+0x105>
nopl   (%rax)
call   1040 <puts@plt>
subl   $0x1,0xc(%rsp)
jae    11b0 <main+0x60>
xor    %eax,%eax
add    $0x2728,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [2 x i8] c"1\00"
@.str.3 = [2 x i8] c"4\00"
@.str.4 = [3 x i8] c"78\00"
@.str.5 = [3 x i8] c"+\0A\00"
@.str.6 = [3 x i8] c"-\0A\00"
@.str.7 = [3 x i8] c"?\0A\00"
@.str.8 = [3 x i8] c"*\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [10000 x i8]
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%6 = call i32 (...) @getchar()
br label %7
7: ; preds = %82, %0
%8 = load i32, i32* %3
%9 = add nsw i32 %8, -1
store i32 %9, i32* %3
%10 = icmp ne i32 %8, 0
br i1 %10, label %11, label %83
11: ; preds = %7
%12 = getelementptr inbounds [10000 x i8], [10000 x i8]* %4, i64 0, i64 0
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = getelementptr inbounds [10000 x i8], [10000 x i8]* %4, i64 0, i64 0
%15 = call i32 @strlen(i8* %14)
store i32 %15, i32* %2
%16 = getelementptr inbounds [10000 x i8], [10000 x i8]* %4, i64 0, i64 0
%17 = call i64 @strcasecmp(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %27, label %19
19: ; preds = %11
%20 = getelementptr inbounds [10000 x i8], [10000 x i8]* %4, i64 0, i64 0
%21 = call i64 @strcasecmp(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %27, label %23
23: ; preds = %19
%24 = getelementptr inbounds [10000 x i8], [10000 x i8]* %4, i64 0, i64 0
%25 = call i64 @strcasecmp(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %23, %19, %11
%28 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %82
29: ; preds = %23
%30 = load i32, i32* %2
%31 = sub nsw i32 %30, 1
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [10000 x i8], [10000 x i8]* %4, i64 0, i64 %32
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = icmp eq i32 %35, 53
br i1 %36, label %37, label %47
37: ; preds = %29
%38 = load i32, i32* %2
%39 = sub nsw i32 %38, 2
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [10000 x i8], [10000 x i8]* %4, i64 0, i64 %40
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 51
br i1 %44, label %45, label %47
45: ; preds = %37
%46 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %81
47: ; preds = %37, %29
%48 = getelementptr inbounds [10000 x i8], [10000 x i8]* %4, i64 0, i64 0
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = icmp eq i32 %50, 49
br i1 %51, label %52, label %64
52: ; preds = %47
%53 = getelementptr inbounds [10000 x i8], [10000 x i8]* %4, i64 0, i64 1
%54 = load i8, i8* %53
%55 = sext i8 %54 to i32
%56 = icmp eq i32 %55, 57
br i1 %56, label %57, label %64
57: ; preds = %52
%58 = getelementptr inbounds [10000 x i8], [10000 x i8]* %4, i64 0, i64 2
%59 = load i8, i8* %58
%60 = sext i8 %59 to i32
%61 = icmp eq i32 %60, 48
br i1 %61, label %62, label %64
62: ; preds = %57
%63 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
br label %80
64: ; preds = %57, %52, %47
%65 = getelementptr inbounds [10000 x i8], [10000 x i8]* %4, i64 0, i64 0
%66 = load i8, i8* %65
%67 = sext i8 %66 to i32
%68 = icmp eq i32 %67, 57
br i1 %68, label %69, label %79
69: ; preds = %64
%70 = load i32, i32* %2
%71 = sub nsw i32 %70, 1
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [10000 x i8], [10000 x i8]* %4, i64 0, i64 %72
%74 = load i8, i8* %73
%75 = sext i8 %74 to i32
%76 = icmp eq i32 %75, 52
br i1 %76, label %77, label %79
77: ; preds = %69
%78 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
br label %79
79: ; preds = %77, %69, %64
br label %80
80: ; preds = %79, %62
br label %81
81: ; preds = %80, %45
br label %82
82: ; preds = %81, %27
br label %7
83: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [2 x i8] c"1\00"
@.str.3 = [2 x i8] c"4\00"
@.str.4 = [3 x i8] c"78\00"
@str = [2 x i8] c"*\00"
@str.9 = [2 x i8] c"?\00"
@str.10 = [2 x i8] c"-\00"
@str.11 = [2 x i8] c"+\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10000 x i8]
%3 = bitcast i32* %1 to i8*
%4 = getelementptr inbounds [10000 x i8], [10000 x i8]* %2, i64 0, i64 0
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = call i32 (...) @getchar()
%7 = load i32, i32* %1
%8 = add nsw i32 %7, -1
store i32 %8, i32* %1
%9 = icmp eq i32 %7, 0
br i1 %9, label %56, label %10
10: ; preds = %0
%11 = getelementptr inbounds [10000 x i8], [10000 x i8]* %2, i64 0, i64 1
%12 = getelementptr inbounds [10000 x i8], [10000 x i8]* %2, i64 0, i64 2
br label %13
13: ; preds = %10, %52
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%15 = call i32 @strlen(i8* %4)
%16 = call i64 @strcasecmp(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %49, label %18
18: ; preds = %13
%19 = call i64 @strcasecmp(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %49, label %21
21: ; preds = %18
%22 = call i64 @strcasecmp(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %49, label %24
24: ; preds = %21
%25 = add nsw i32 %15, -1
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [10000 x i8], [10000 x i8]* %2, i64 0, i64 %26
%28 = load i8, i8* %27
%29 = icmp eq i8 %28, 53
br i1 %29, label %30, label %36
30: ; preds = %24
%31 = add nsw i32 %15, -2
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [10000 x i8], [10000 x i8]* %2, i64 0, i64 %32
%34 = load i8, i8* %33
%35 = icmp eq i8 %34, 51
br i1 %35, label %49, label %36
36: ; preds = %30, %24
%37 = load i8, i8* %4
%38 = icmp eq i8 %37, 49
%39 = load i8, i8* %11
%40 = icmp eq i8 %39, 57
%41 = select i1 %38, i1 %40, i1 false
%42 = load i8, i8* %12
%43 = icmp eq i8 %42, 48
%44 = select i1 %41, i1 %43, i1 false
br i1 %44, label %49, label %45
45: ; preds = %36
%46 = icmp eq i8 %37, 57
%47 = icmp eq i8 %28, 52
%48 = select i1 %46, i1 %47, i1 false
br i1 %48, label %49, label %52
49: ; preds = %45, %36, %30, %13, %18, %21
%50 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.11, i64 0, i64 0), %21 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.11, i64 0, i64 0), %18 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.11, i64 0, i64 0), %13 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.10, i64 0, i64 0), %30 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.9, i64 0, i64 0), %36 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0), %45 ]
%51 = call i32 @puts(i8* dereferenceable(1) %50)
br label %52
52: ; preds = %49, %45
%53 = load i32, i32* %1
%54 = add nsw i32 %53, -1
store i32 %54, i32* %1
%55 = icmp eq i32 %53, 0
br i1 %55, label %56, label %13
56: ; preds = %52, %0
ret i32 0
}