1. 

/**
* FWP, Ausgewählte Probleme aus dem ACM Programming Contest, SS10
* Problem: 579 Clock Hands
*
* @author Robert Reichart
*
* Status : Accepted
* Runtime: 2.164
*/

import java.io.*;
import java.text.*;
class Main{
static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
public static void main(String... args){
try{
String line = readLine();
while(!line.equals("0:00")){
//System.out.println(line);
String[] hm = line.split(":");
int h=Integer.parseInt(hm[0]);
int m=Integer.parseInt(hm[1]);

double HAnglePM = 0.5;

double HAnglePH = 30;

double MAnglePM = 6;

double MAngle=m*MAnglePM;
//System.out.println("MAngle= " + MAngle);
double HAngle=h*HAnglePH+m*HAnglePM;
//System.out.println("HAngle= " + MAngle);
double angle=Math.abs(HAngle-MAngle);
if(angle>180){angle=360-angle;}
DecimalFormat df = new DecimalFormat ( "0.000" );
//System.out.println("angle=" + angle);

System.out.println(df.format(angle));
line=readLine();
}
}catch(Exception ex){}
}

static String readLine(){
try{
String line=in.readLine();
while(line.equals("")){
line=in.readLine();
}
return line;
}catch(Exception ex){return null;}
}
}