#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 *, double);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int t;
  double ac = 0, tk;
  char ch[7];
  scanf("%d", &t);
  while (t) {
    scanf("%s", ch);
    if (ch[0] == 'd') {
      scanf("%lf", &tk);
      ac += tk;
    } else
      printf("%.0lf\n", ac);
    t--;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
lea    0xec2(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
je     11b7 <main+0x97>
lea    -0x1f(%rbp),%rsi
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
movsbl -0x1f(%rbp),%eax
cmp    $0x64,%eax
jne    1198 <main+0x78>
lea    0xe8d(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movsd  -0x18(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    11a9 <main+0x89>
movsd  -0x10(%rbp),%xmm0
lea    0xe66(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1149 <main+0x29>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x20,%rsp
lea    0xecc(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
je     11cf <main+0xaf>
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0xea7(%rip),%r14
lea    0x11(%rsp),%rbx
lea    0xe9e(%rip),%r15
lea    0x18(%rsp),%r12
lea    0xe96(%rip),%r13
jmp    1195 <main+0x75>
cs nopw 0x0(%rax,%rax,1)
mov    %r13,%rdi
movsd  0x8(%rsp),%xmm0
call   1030 <printf@plt>
addl   $0xffffffff,0x4(%rsp)
je     11cf <main+0xaf>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpb   $0x64,0x11(%rsp)
jne    1180 <main+0x60>
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
movsd  0x8(%rsp),%xmm0
addsd  0x18(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
addl   $0xffffffff,0x4(%rsp)
jne    1195 <main+0x75>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [4 x i8] c"%lf\00"
@.str.3 = [7 x i8] c"%.0lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
%4 = alloca double
%5 = alloca [7 x i8]
store i32 0, i32* %1
store double 0.000000e+00, double* %3
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %7
7: ; preds = %25, %0
%8 = load i32, i32* %2
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %28
10: ; preds = %7
%11 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 0
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 0
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 100
br i1 %16, label %17, label %22
17: ; preds = %10
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %4)
%19 = load double, double* %4
%20 = load double, double* %3
%21 = fadd double %20, %19
store double %21, double* %3
br label %25
22: ; preds = %10
%23 = load double, double* %3
%24 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), double %23)
br label %25
25: ; preds = %22, %17
%26 = load i32, i32* %2
%27 = add nsw i32 %26, -1
store i32 %27, i32* %2
br label %7
28: ; 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 = [4 x i8] c"%lf\00"
@.str.3 = [7 x i8] c"%.0lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca [7 x i8]
%4 = bitcast i32* %1 to i8*
%5 = bitcast double* %2 to i8*
%6 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = icmp eq i32 %8, 0
br i1 %9, label %26, label %10
10: ; preds = %0, %21
%11 = phi double [ %22, %21 ], [ 0.000000e+00, %0 ]
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%13 = load i8, i8* %6
%14 = icmp eq i8 %13, 100
br i1 %14, label %15, label %19
15: ; preds = %10
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %2)
%17 = load double, double* %2
%18 = fadd double %11, %17
br label %21
19: ; preds = %10
%20 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), double %11)
br label %21
21: ; preds = %19, %15
%22 = phi double [ %18, %15 ], [ %11, %19 ]
%23 = load i32, i32* %1
%24 = add nsw i32 %23, -1
store i32 %24, i32* %1
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %10
26: ; preds = %21, %0
ret i32 0
}