#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);
int scanf(char *, int *, int *);
int main() {
  int h, m;
  int ans;
  while (scanf("%d %*c %2d", &h, &m) == 2) {
    if (h == 0 && m == 0)
      break;
    ans = (h * 5 - m) * 6;
    if (ans >= 0)
      if (ans + 0.5 * m > 180)
        printf("%.3f\n", 360 - ans - 0.5 * m);
      else
        printf("%.3f\n", ans + 0.5 * m);
    else {
      if (ans + 0.5 * m < -180)
        printf("%.3f\n", ans + 0.5 * m + 360);
      else {
        if (ans + 0.5 * m >= 0)
          printf("%.3f\n", ans + 0.5 * m);
        else
          printf("%.3f\n", -ans - 0.5 * m);
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xef2(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
cmp    $0x2,%eax
jne    1307 <main+0x1e7>
cmpl   $0x0,-0x8(%rbp)
jne    1165 <main+0x45>
cmpl   $0x0,-0xc(%rbp)
jne    1165 <main+0x45>
jmp    1307 <main+0x1e7>
imul   $0x5,-0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
imul   $0x6,%eax,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jl     120d <main+0xed>
cvtsi2sdl -0x10(%rbp),%xmm1
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  0xe7a(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe82(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11de <main+0xbe>
mov    $0x168,%eax
sub    -0x10(%rbp),%eax
cvtsi2sd %eax,%xmm1
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  0xe4f(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
lea    0xe5f(%rip),%rdi
call   1030 <printf@plt>
jmp    1208 <main+0xe8>
cvtsi2sdl -0x10(%rbp),%xmm1
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  0xe18(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
lea    0xe30(%rip),%rdi
call   1030 <printf@plt>
jmp    1302 <main+0x1e2>
cvtsi2sdl -0x10(%rbp),%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
movsd  0xde9(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xdd1(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1274 <main+0x154>
cvtsi2sdl -0x10(%rbp),%xmm1
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  0xdbd(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xdbd(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
lea    0xdc9(%rip),%rdi
call   1030 <printf@plt>
jmp    12fd <main+0x1dd>
cvtsi2sdl -0x10(%rbp),%xmm1
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  0xd82(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     12ca <main+0x1aa>
cvtsi2sdl -0x10(%rbp),%xmm1
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  0xd5b(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
lea    0xd73(%rip),%rdi
call   1030 <printf@plt>
jmp    12f8 <main+0x1d8>
xor    %eax,%eax
sub    -0x10(%rbp),%eax
cvtsi2sd %eax,%xmm1
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  0xd30(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
lea    0xd40(%rip),%rdi
call   1030 <printf@plt>
jmp    12fd <main+0x1dd>
jmp    1302 <main+0x1e2>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xf01(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
cmp    $0x2,%eax
jne    122e <main+0x10e>
lea    0xeef(%rip),%r14
lea    0xedd(%rip),%r15
lea    0x4(%rsp),%r12
mov    %rsp,%rbx
jmp    1193 <main+0x73>
addsd  0xeb3(%rip),%xmm1
cs nopw 0x0(%rax,%rax,1)
nop
cvttsd2si %xmm1,%esi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1040 <scanf@plt>
cmp    $0x2,%eax
jne    122e <main+0x10e>
mov    0x4(%rsp),%eax
mov    (%rsp),%ecx
mov    %eax,%edx
or     %ecx,%edx
je     122e <main+0x10e>
lea    (%rax,%rax,4),%edx
sub    %ecx,%edx
lea    (%rdx,%rdx,1),%eax
lea    (%rax,%rax,2),%eax
xorps  %xmm2,%xmm2
cvtsi2sd %eax,%xmm2
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
movapd %xmm0,%xmm1
mulsd  0xe37(%rip),%xmm1
addsd  %xmm2,%xmm1
test   %edx,%edx
js     11f0 <main+0xd0>
ucomisd 0xe47(%rip),%xmm1
jbe    1170 <main+0x50>
mov    $0x168,%ecx
sub    %eax,%ecx
xorps  %xmm1,%xmm1
cvtsi2sd %ecx,%xmm1
jmp    1219 <main+0xf9>
nopl   0x0(%rax,%rax,1)
movsd  0xe10(%rip),%xmm2
ucomisd %xmm1,%xmm2
ja     115d <main+0x3d>
ucomisd 0xe1e(%rip),%xmm1
jae    1170 <main+0x50>
neg    %eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
mulsd  0xdef(%rip),%xmm0
addsd  %xmm1,%xmm0
movapd %xmm0,%xmm1
jmp    1170 <main+0x50>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [11 x i8] c"%d %*c %2d\00"
@.str.1 = [6 x i8] c"%.3f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
br label %5
5: ; preds = %90, %0
%6 = call i32 @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%7 = icmp eq i32 %6, 2
br i1 %7, label %8, label %91
8: ; preds = %5
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %8
%12 = load i32, i32* %3
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %11
br label %91
15: ; preds = %11, %8
%16 = load i32, i32* %2
%17 = mul nsw i32 %16, 5
%18 = load i32, i32* %3
%19 = sub nsw i32 %17, %18
%20 = mul nsw i32 %19, 6
store i32 %20, i32* %4
%21 = load i32, i32* %4
%22 = icmp sge i32 %21, 0
br i1 %22, label %23, label %48
23: ; preds = %15
%24 = load i32, i32* %4
%25 = sitofp i32 %24 to double
%26 = load i32, i32* %3
%27 = sitofp i32 %26 to double
%28 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %27, double %25)
%29 = fcmp ogt double %28, 1.800000e+02
br i1 %29, label %30, label %39
30: ; preds = %23
%31 = load i32, i32* %4
%32 = sub nsw i32 360, %31
%33 = sitofp i32 %32 to double
%34 = load i32, i32* %3
%35 = sitofp i32 %34 to double
%36 = call double @llvm.fmuladd.f64(double -5.000000e-01, double %35, double %33)
%37 = fptosi double %36 to i32
%38 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %37)
br label %47
39: ; preds = %23
%40 = load i32, i32* %4
%41 = sitofp i32 %40 to double
%42 = load i32, i32* %3
%43 = sitofp i32 %42 to double
%44 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %43, double %41)
%45 = fptosi double %44 to i32
%46 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %45)
br label %47
47: ; preds = %39, %30
br label %90
48: ; preds = %15
%49 = load i32, i32* %4
%50 = sitofp i32 %49 to double
%51 = load i32, i32* %3
%52 = sitofp i32 %51 to double
%53 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %52, double %50)
%54 = fcmp olt double %53, -1.800000e+02
br i1 %54, label %55, label %64
55: ; preds = %48
%56 = load i32, i32* %4
%57 = sitofp i32 %56 to double
%58 = load i32, i32* %3
%59 = sitofp i32 %58 to double
%60 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %59, double %57)
%61 = fadd double %60, 3.600000e+02
%62 = fptosi double %61 to i32
%63 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %62)
br label %89
64: ; preds = %48
%65 = load i32, i32* %4
%66 = sitofp i32 %65 to double
%67 = load i32, i32* %3
%68 = sitofp i32 %67 to double
%69 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %68, double %66)
%70 = fcmp oge double %69, 0.000000e+00
br i1 %70, label %71, label %79
71: ; preds = %64
%72 = load i32, i32* %4
%73 = sitofp i32 %72 to double
%74 = load i32, i32* %3
%75 = sitofp i32 %74 to double
%76 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %75, double %73)
%77 = fptosi double %76 to i32
%78 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %77)
br label %88
79: ; preds = %64
%80 = load i32, i32* %4
%81 = sub nsw i32 0, %80
%82 = sitofp i32 %81 to double
%83 = load i32, i32* %3
%84 = sitofp i32 %83 to double
%85 = call double @llvm.fmuladd.f64(double -5.000000e-01, double %84, double %82)
%86 = fptosi double %85 to i32
%87 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %86)
br label %88
88: ; preds = %79, %71
br label %89
89: ; preds = %88, %55
br label %90
90: ; preds = %89, %47
br label %5
91: ; preds = %14, %5
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"%d %*c %2d\00"
@.str.1 = [6 x i8] c"%.3f\0A\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 ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = icmp eq i32 %5, 2
br i1 %6, label %7, label %43
7: ; preds = %0, %37
%8 = load i32, i32* %1
%9 = icmp eq i32 %8, 0
%10 = load i32, i32* %2
%11 = icmp eq i32 %10, 0
%12 = select i1 %9, i1 %11, i1 false
br i1 %12, label %43, label %13
13: ; preds = %7
%14 = mul nsw i32 %8, 5
%15 = sub nsw i32 %14, %10
%16 = mul nsw i32 %15, 6
%17 = icmp sgt i32 %15, -1
%18 = sitofp i32 %16 to double
%19 = sitofp i32 %10 to double
%20 = call double @llvm.fmuladd.f64(double %19, double 5.000000e-01, double %18)
br i1 %17, label %21, label %27
21: ; preds = %13
%22 = fcmp ogt double %20, 1.800000e+02
br i1 %22, label %23, label %37
23: ; preds = %21
%24 = sub nsw i32 360, %16
%25 = sitofp i32 %24 to double
%26 = call double @llvm.fmuladd.f64(double %19, double -5.000000e-01, double %25)
br label %37
27: ; preds = %13
%28 = fcmp olt double %20, -1.800000e+02
br i1 %28, label %29, label %31
29: ; preds = %27
%30 = fadd double %20, 3.600000e+02
br label %37
31: ; preds = %27
%32 = fcmp ult double %20, 0.000000e+00
br i1 %32, label %33, label %37
33: ; preds = %31
%34 = sub nsw i32 0, %16
%35 = sitofp i32 %34 to double
%36 = call double @llvm.fmuladd.f64(double %19, double -5.000000e-01, double %35)
br label %37
37: ; preds = %31, %21, %29, %33, %23
%38 = phi double [ %30, %29 ], [ %36, %33 ], [ %26, %23 ], [ %20, %21 ], [ %20, %31 ]
%39 = fptosi double %38 to i32
%40 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %39)
%41 = call i32 @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%42 = icmp eq i32 %41, 2
br i1 %42, label %7, label %43
43: ; preds = %37, %7, %0
ret i32 0
}