#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 */
double fabs(double);
int /*<<< orphan*/ printf(char *, double);
int scanf(char *, int *, int *);
main() {
  int i, j, k, l, m, n;
  double x, y, z;
  while (scanf("%d:%d", &i, &j) == 2) {
    if (i == 0 && j == 0)
      break;
    z = i * 30 + j / 2.0 - 6 * j;
    z = fabs(z);
    if (z > 180)
      z = 360 - z;
    printf("%.3lf\n", z);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xefa(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
cmp    $0x2,%eax
jne    11e7 <main+0xc7>
cmpl   $0x0,-0x8(%rbp)
jne    1165 <main+0x45>
cmpl   $0x0,-0xc(%rbp)
jne    1165 <main+0x45>
jmp    11e7 <main+0xc7>
imul   $0x1e,-0x8(%rbp),%eax
cvtsi2sd %eax,%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
movsd  0xe8e(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
imul   $0x6,-0xc(%rbp),%eax
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movaps 0xe81(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  0xe4b(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11d1 <main+0xb1>
movsd  0xe49(%rip),%xmm0
subsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
lea    0xe59(%rip),%rdi
call   1030 <printf@plt>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x40,%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    11ec <main+0xcc>
lea    0xeea(%rip),%r14
lea    0xedd(%rip),%r15
lea    0x4(%rsp),%r12
mov    %rsp,%rbx
nopl   0x0(%rax,%rax,1)
mov    0x4(%rsp),%ecx
mov    (%rsp),%eax
mov    %ecx,%edx
or     %eax,%edx
je     11ec <main+0xcc>
mov    %ecx,%edx
shl    $0x5,%edx
sub    %ecx,%edx
sub    %ecx,%edx
xorps  %xmm0,%xmm0
cvtsi2sd %edx,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
mulsd  0xe74(%rip),%xmm1
add    %eax,%eax
lea    (%rax,%rax,2),%eax
xorps  %xmm2,%xmm2
cvtsi2sd %eax,%xmm2
addsd  %xmm0,%xmm1
subsd  %xmm2,%xmm1
andpd  0xe78(%rip),%xmm1
movsd  0xe58(%rip),%xmm2
subsd  %xmm1,%xmm2
movsd  0xe54(%rip),%xmm0
cmpltsd %xmm1,%xmm0
andpd  %xmm0,%xmm2
andnpd %xmm1,%xmm0
orpd   %xmm2,%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1040 <scanf@plt>
cmp    $0x2,%eax
je     1160 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d:%d\00"
@.str.1 = [7 x i8] c"%.3lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca double
%9 = alloca double
%10 = alloca double
store i32 0, i32* %1
br label %11
11: ; preds = %40, %0
%12 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%13 = icmp eq i32 %12, 2
br i1 %13, label %14, label %43
14: ; preds = %11
%15 = load i32, i32* %2
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %14
%18 = load i32, i32* %3
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %17
br label %43
21: ; preds = %17, %14
%22 = load i32, i32* %2
%23 = mul nsw i32 %22, 30
%24 = sitofp i32 %23 to double
%25 = load i32, i32* %3
%26 = sitofp i32 %25 to double
%27 = fdiv double %26, 2.000000e+00
%28 = fadd double %24, %27
%29 = load i32, i32* %3
%30 = mul nsw i32 6, %29
%31 = sitofp i32 %30 to double
%32 = fsub double %28, %31
store double %32, double* %10
%33 = load double, double* %10
%34 = call double @llvm.fabs.f64(double %33)
store double %34, double* %10
%35 = load double, double* %10
%36 = fcmp ogt double %35, 1.800000e+02
br i1 %36, label %37, label %40
37: ; preds = %21
%38 = load double, double* %10
%39 = fsub double 3.600000e+02, %38
store double %39, double* %10
br label %40
40: ; preds = %37, %21
%41 = load double, double* %10
%42 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %41)
br label %11
43: ; preds = %20, %11
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d:%d\00"
@.str.1 = [7 x i8] c"%.3lf\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 ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = icmp eq i32 %5, 2
br i1 %6, label %7, label %29
7: ; preds = %0, %13
%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 %29, label %13
13: ; preds = %7
%14 = mul nsw i32 %8, 30
%15 = sitofp i32 %14 to double
%16 = sitofp i32 %10 to double
%17 = fmul double %16, 5.000000e-01
%18 = fadd double %17, %15
%19 = mul nsw i32 %10, 6
%20 = sitofp i32 %19 to double
%21 = fsub double %18, %20
%22 = call double @llvm.fabs.f64(double %21)
%23 = fcmp ogt double %22, 1.800000e+02
%24 = fsub double 3.600000e+02, %22
%25 = select i1 %23, double %24, double %22
%26 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %25)
%27 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%28 = icmp eq i32 %27, 2
br i1 %28, label %7, label %29
29: ; preds = %13, %7, %0
ret i32 0
}