#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 cnum(char *);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int T, count;
  char str[1000000];
  scanf("%d", &T);
  while (T--) {
    getchar();
    gets(str);
    count = cnum(str);
    printf("%d\n", count * 420);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf4250,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe97(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     11c0 <main+0x70>
mov    $0x0,%al
call   1040 <getchar@plt>
lea    -0xf4250(%rbp),%rdi
call   1050 <gets@plt>
lea    -0xf4250(%rbp),%rdi
call   1070 <cnum@plt>
mov    %eax,-0xc(%rbp)
imul   $0x1a4,-0xc(%rbp),%esi
lea    0xe4d(%rip),%rdi
call   1030 <printf@plt>
jmp    1172 <main+0x22>
xor    %eax,%eax
add    $0xf4250,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0xf4258,%rsp
lea    0xe9f(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
subl   $0x1,0xc(%rsp)
jb     11ac <main+0x5c>
lea    0x10(%rsp),%rbx
lea    0xe85(%rip),%r14
xchg   %ax,%ax
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %rbx,%rdi
call   1050 <gets@plt>
mov    %rbx,%rdi
call   1070 <cnum@plt>
imul   $0x1a4,%eax,%esi
mov    %r14,%rdi
call   1030 <printf@plt>
subl   $0x1,0xc(%rsp)
jae    1180 <main+0x30>
xor    %eax,%eax
add    $0xf4258,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [1000000 x i8]
store i32 0, i32* %1
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %6
6: ; preds = %10, %0
%7 = load i32, i32* %2
%8 = add nsw i32 %7, -1
store i32 %8, i32* %2
%9 = icmp ne i32 %7, 0
br i1 %9, label %10, label %19
10: ; preds = %6
%11 = call i32 (...) @getchar()
%12 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %4, i64 0, i64 0
%13 = call i32 @gets(i8* %12)
%14 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %4, i64 0, i64 0
%15 = call i32 @cnum(i8* %14)
store i32 %15, i32* %3
%16 = load i32, i32* %3
%17 = mul nsw i32 %16, 420
%18 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %17)
br label %6
19: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1000000 x i8]
%3 = bitcast i32* %1 to i8*
%4 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %2, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = add nsw i32 %6, -1
store i32 %7, i32* %1
%8 = icmp eq i32 %6, 0
br i1 %8, label %18, label %9
9: ; preds = %0, %9
%10 = call i32 (...) @getchar()
%11 = call i32 @gets(i8* %4)
%12 = call i32 @cnum(i8* %4)
%13 = mul nsw i32 %12, 420
%14 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = load i32, i32* %1
%16 = add nsw i32 %15, -1
store i32 %16, i32* %1
%17 = icmp eq i32 %15, 0
br i1 %17, label %18, label %9
18: ; preds = %9, %0
ret i32 0
}