#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 getchar();
double prefix(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int num_case, index_case = 0;
  scanf("%d\n", &num_case);
  while (num_case--) {
    index_case++;
    double I, U, P;
    int flag_get_iup[3] = {0};
    int text;
    while ((text = getchar()) != '\n') {
      if (text == 'I' && (text = getchar()) == '=') {
        scanf("%lf", &I);
        flag_get_iup[0] = 1;
        if ((text = getchar()) != 'A')
          I *= prefix(text);
      } else if (text == 'U' && (text = getchar()) == '=') {
        scanf("%lf", &U);
        flag_get_iup[1] = 1;
        if ((text = getchar()) != 'V')
          U *= prefix(text);
      } else if (text == 'P' && (text = getchar()) == '=') {
        scanf("%lf", &P);
        flag_get_iup[2] = 1;
        if ((text = getchar()) != 'W')
          P *= prefix(text);
      }
    }
    printf("Problem #%d\n", index_case);
    if (!flag_get_iup[0])
      printf("I=%.2lfA\n", P / U);
    else if (!flag_get_iup[1])
      printf("U=%.2lfV\n", P / I);
    else
      printf("P=%.2lfW\n", I * U);
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xea0(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     1376 <main+0x226>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
lea    -0x34(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1040 <memset@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x38(%rbp)
cmp    $0xa,%eax
je     12e7 <main+0x197>
cmpl   $0x49,-0x38(%rbp)
jne    1218 <main+0xc8>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x38(%rbp)
cmp    $0x3d,%eax
jne    1218 <main+0xc8>
lea    0xe24(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
movl   $0x1,-0x34(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x38(%rbp)
cmp    $0x41,%eax
je     1213 <main+0xc3>
mov    -0x38(%rbp),%edi
call   1070 <prefix@plt>
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    12e2 <main+0x192>
cmpl   $0x55,-0x38(%rbp)
jne    1278 <main+0x128>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x38(%rbp)
cmp    $0x3d,%eax
jne    1278 <main+0x128>
lea    0xdc4(%rip),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
movl   $0x1,-0x30(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x38(%rbp)
cmp    $0x56,%eax
je     1273 <main+0x123>
mov    -0x38(%rbp),%edi
call   1070 <prefix@plt>
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    12dd <main+0x18d>
cmpl   $0x50,-0x38(%rbp)
jne    12d8 <main+0x188>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x38(%rbp)
cmp    $0x3d,%eax
jne    12d8 <main+0x188>
lea    0xd64(%rip),%rdi
lea    -0x28(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
movl   $0x1,-0x2c(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x38(%rbp)
cmp    $0x57,%eax
je     12d3 <main+0x183>
mov    -0x38(%rbp),%edi
call   1070 <prefix@plt>
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    12d8 <main+0x188>
jmp    12dd <main+0x18d>
jmp    12e2 <main+0x192>
jmp    11a5 <main+0x55>
mov    -0xc(%rbp),%esi
lea    0xd13(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x34(%rbp)
jne    131f <main+0x1cf>
movsd  -0x28(%rbp),%xmm0
divsd  -0x20(%rbp),%xmm0
lea    0xcfe(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1363 <main+0x213>
cmpl   $0x0,-0x30(%rbp)
jne    1346 <main+0x1f6>
movsd  -0x28(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
lea    0xce1(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    135e <main+0x20e>
movsd  -0x18(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
lea    0xcce(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1363 <main+0x213>
lea    0xcaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1178 <main+0x28>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xea8(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
subl   $0x1,0xc(%rsp)
jae    1189 <main+0x39>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe70(%rip),%rbx
lea    0x20(%rsp),%r14
lea    0x18(%rsp),%r15
lea    0x10(%rsp),%r12
movl   $0x0,0x8(%rsp)
jmp    11db <main+0x8b>
nopl   0x0(%rax)
movsd  0x10(%rsp),%xmm0
divsd  0x18(%rsp),%xmm0
lea    0xe4e(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
subl   $0x1,0xc(%rsp)
jb     1178 <main+0x28>
xor    %ebp,%ebp
xor    %r13d,%r13d
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0x49,%eax
je     1200 <main+0xb0>
cmp    $0xa,%eax
jne    1240 <main+0xf0>
jmp    12e0 <main+0x190>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0x3d,%eax
jne    1240 <main+0xf0>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    $0x1,%ebp
cmp    $0x41,%eax
je     11e0 <main+0x90>
mov    %eax,%edi
call   1070 <prefix@plt>
mulsd  0x20(%rsp),%xmm0
movsd  %xmm0,0x20(%rsp)
jmp    11e0 <main+0x90>
nop
cmp    $0x55,%eax
jne    1290 <main+0x140>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0x3d,%eax
jne    1290 <main+0x140>
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    $0x1,%r13d
cmp    $0x56,%eax
je     11e0 <main+0x90>
mov    %eax,%edi
call   1070 <prefix@plt>
mulsd  0x18(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
jmp    11e0 <main+0x90>
nopl   0x0(%rax)
cmp    $0x50,%eax
jne    11e0 <main+0x90>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0x3d,%eax
jne    11e0 <main+0x90>
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0x57,%eax
je     11e0 <main+0x90>
mov    %eax,%edi
call   1070 <prefix@plt>
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
jmp    11e0 <main+0x90>
xchg   %ax,%ax
mov    0x8(%rsp),%esi
add    $0x1,%esi
lea    0xd16(%rip),%rdi
mov    %esi,0x8(%rsp)
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebp,%ebp
je     11b0 <main+0x60>
test   %r13d,%r13d
je     1320 <main+0x1d0>
movsd  0x20(%rsp),%xmm0
mulsd  0x18(%rsp),%xmm0
lea    0xd0c(%rip),%rdi
jmp    11c3 <main+0x73>
xchg   %ax,%ax
movsd  0x10(%rsp),%xmm0
divsd  0x20(%rsp),%xmm0
lea    0xce8(%rip),%rdi
jmp    11c3 <main+0x73>

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [13 x i8] c"Problem #%d\0A\00"
@.str.3 = [10 x i8] c"I=%.2lfA\0A\00"
@.str.4 = [10 x i8] c"U=%.2lfV\0A\00"
@.str.5 = [10 x i8] c"P=%.2lfW\0A\00"
@.str.6 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca [3 x i32]
%8 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %10
10: ; preds = %101, %0
%11 = load i32, i32* %2
%12 = add nsw i32 %11, -1
store i32 %12, i32* %2
%13 = icmp ne i32 %11, 0
br i1 %13, label %14, label %103
14: ; preds = %10
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
%17 = bitcast [3 x i32]* %7 to i8*
br label %18
18: ; preds = %74, %14
%19 = call i32 (...) @getchar()
store i32 %19, i32* %8
%20 = icmp ne i32 %19, 10
br i1 %20, label %21, label %75
21: ; preds = %18
%22 = load i32, i32* %8
%23 = icmp eq i32 %22, 73
br i1 %23, label %24, label %38
24: ; preds = %21
%25 = call i32 (...) @getchar()
store i32 %25, i32* %8
%26 = icmp eq i32 %25, 61
br i1 %26, label %27, label %38
27: ; preds = %24
%28 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %4)
%29 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 0
store i32 1, i32* %29
%30 = call i32 (...) @getchar()
store i32 %30, i32* %8
%31 = icmp ne i32 %30, 65
br i1 %31, label %32, label %37
32: ; preds = %27
%33 = load i32, i32* %8
%34 = call double @prefix(i32 %33)
%35 = load double, double* %4
%36 = fmul double %35, %34
store double %36, double* %4
br label %37
37: ; preds = %32, %27
br label %74
38: ; preds = %24, %21
%39 = load i32, i32* %8
%40 = icmp eq i32 %39, 85
br i1 %40, label %41, label %55
41: ; preds = %38
%42 = call i32 (...) @getchar()
store i32 %42, i32* %8
%43 = icmp eq i32 %42, 61
br i1 %43, label %44, label %55
44: ; preds = %41
%45 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %5)
%46 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 1
store i32 1, i32* %46
%47 = call i32 (...) @getchar()
store i32 %47, i32* %8
%48 = icmp ne i32 %47, 86
br i1 %48, label %49, label %54
49: ; preds = %44
%50 = load i32, i32* %8
%51 = call double @prefix(i32 %50)
%52 = load double, double* %5
%53 = fmul double %52, %51
store double %53, double* %5
br label %54
54: ; preds = %49, %44
br label %73
55: ; preds = %41, %38
%56 = load i32, i32* %8
%57 = icmp eq i32 %56, 80
br i1 %57, label %58, label %72
58: ; preds = %55
%59 = call i32 (...) @getchar()
store i32 %59, i32* %8
%60 = icmp eq i32 %59, 61
br i1 %60, label %61, label %72
61: ; preds = %58
%62 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %6)
%63 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 2
store i32 1, i32* %63
%64 = call i32 (...) @getchar()
store i32 %64, i32* %8
%65 = icmp ne i32 %64, 87
br i1 %65, label %66, label %71
66: ; preds = %61
%67 = load i32, i32* %8
%68 = call double @prefix(i32 %67)
%69 = load double, double* %6
%70 = fmul double %69, %68
store double %70, double* %6
br label %71
71: ; preds = %66, %61
br label %72
72: ; preds = %71, %58, %55
br label %73
73: ; preds = %72, %54
br label %74
74: ; preds = %73, %37
br label %18
75: ; preds = %18
%76 = load i32, i32* %3
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %76)
%78 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 0
%79 = load i32, i32* %78
%80 = icmp ne i32 %79, 0
br i1 %80, label %86, label %81
81: ; preds = %75
%82 = load double, double* %6
%83 = load double, double* %5
%84 = fdiv double %82, %83
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), double %84)
br label %101
86: ; preds = %75
%87 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 1
%88 = load i32, i32* %87
%89 = icmp ne i32 %88, 0
br i1 %89, label %95, label %90
90: ; preds = %86
%91 = load double, double* %6
%92 = load double, double* %4
%93 = fdiv double %91, %92
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), double %93)
br label %100
95: ; preds = %86
%96 = load double, double* %4
%97 = load double, double* %5
%98 = fmul double %96, %97
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), double %98)
br label %100
100: ; preds = %95, %90
br label %101
101: ; preds = %100, %81
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %10
103: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [13 x i8] c"Problem #%d\0A\00"
@.str.3 = [10 x i8] c"I=%.2lfA\0A\00"
@.str.4 = [10 x i8] c"U=%.2lfV\0A\00"
@.str.5 = [10 x i8] c"P=%.2lfW\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = bitcast i32* %1 to i8*
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%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 %88, label %10
10: ; preds = %0
%11 = bitcast double* %2 to i8*
%12 = bitcast double* %3 to i8*
%13 = bitcast double* %4 to i8*
br label %14
14: ; preds = %10, %83
%15 = phi i32 [ 0, %10 ], [ %63, %83 ]
br label %16
16: ; preds = %45, %14
%17 = phi i32 [ 0, %14 ], [ %46, %45 ]
%18 = phi i32 [ 0, %14 ], [ %47, %45 ]
%19 = call i32 (...) @getchar()
switch i32 %19, label %31 [
i32 10, label %62
i32 73, label %20
]
20: ; preds = %16
%21 = call i32 (...) @getchar()
%22 = icmp eq i32 %21, 61
br i1 %22, label %23, label %31
23: ; preds = %20
%24 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%25 = call i32 (...) @getchar()
%26 = icmp eq i32 %25, 65
br i1 %26, label %45, label %27
27: ; preds = %23
%28 = call double @prefix(i32 %25)
%29 = load double, double* %2
%30 = fmul double %28, %29
store double %30, double* %2
br label %45
31: ; preds = %16, %20
%32 = phi i32 [ %21, %20 ], [ %19, %16 ]
%33 = icmp eq i32 %32, 85
br i1 %33, label %34, label %48
34: ; preds = %31
%35 = call i32 (...) @getchar()
%36 = icmp eq i32 %35, 61
br i1 %36, label %37, label %48
37: ; preds = %34
%38 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %3)
%39 = call i32 (...) @getchar()
%40 = icmp eq i32 %39, 86
br i1 %40, label %45, label %41
41: ; preds = %37
%42 = call double @prefix(i32 %39)
%43 = load double, double* %3
%44 = fmul double %42, %43
store double %44, double* %3
br label %45
45: ; preds = %41, %37, %54, %58, %51, %48, %23, %27
%46 = phi i32 [ 1, %27 ], [ 1, %23 ], [ %17, %41 ], [ %17, %37 ], [ %17, %58 ], [ %17, %54 ], [ %17, %51 ], [ %17, %48 ]
%47 = phi i32 [ %18, %27 ], [ %18, %23 ], [ 1, %41 ], [ 1, %37 ], [ %18, %58 ], [ %18, %54 ], [ %18, %51 ], [ %18, %48 ]
br label %16
48: ; preds = %34, %31
%49 = phi i32 [ %35, %34 ], [ %32, %31 ]
%50 = icmp eq i32 %49, 80
br i1 %50, label %51, label %45
51: ; preds = %48
%52 = call i32 (...) @getchar()
%53 = icmp eq i32 %52, 61
br i1 %53, label %54, label %45
54: ; preds = %51
%55 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %4)
%56 = call i32 (...) @getchar()
%57 = icmp eq i32 %56, 87
br i1 %57, label %45, label %58
58: ; preds = %54
%59 = call double @prefix(i32 %56)
%60 = load double, double* %4
%61 = fmul double %59, %60
store double %61, double* %4
br label %45
62: ; preds = %16
%63 = add nuw nsw i32 %15, 1
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %63)
%65 = icmp eq i32 %17, 0
br i1 %65, label %66, label %71
66: ; preds = %62
%67 = load double, double* %4
%68 = load double, double* %3
%69 = fdiv double %67, %68
%70 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), double %69)
br label %83
71: ; preds = %62
%72 = icmp eq i32 %18, 0
br i1 %72, label %73, label %78
73: ; preds = %71
%74 = load double, double* %4
%75 = load double, double* %2
%76 = fdiv double %74, %75
%77 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), double %76)
br label %83
78: ; preds = %71
%79 = load double, double* %2
%80 = load double, double* %3
%81 = fmul double %79, %80
%82 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), double %81)
br label %83
83: ; preds = %73, %78, %66
%84 = call i32 @putchar(i32 10)
%85 = load i32, i32* %1
%86 = add nsw i32 %85, -1
store i32 %86, i32* %1
%87 = icmp eq i32 %85, 0
br i1 %87, label %88, label %14
88: ; preds = %83, %0
ret i32 0
}