/***********************************************************
题意:一个时钟,有三根指针,秒钟分钟和时钟,当每跟指针跟其他两根相差角度大于 D 时,为happy的时间,给定 D 求一天中有百分之多少的时间是happy的;
思路:两根两根的考虑,求出每个的区间,再把三组区间求交集
设两根针的相对速度为 v 度每秒,那么相差度数大于x则有 k * 360 + D < t * v < k * 360 + 360 - D;
那么区间就是[(k * 360 + D) / v, (k * 360 + 360 - D) / v]
************************************************************/
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
using namespace std;
struct Endpoint
{
double pos ;
int k ;
}endpoint[60 * 12 * 6 + 10];
double s_m = 360.0 / 60.0 - 360.0 / 60.0 / 60.0;
double m_h = 360.0 / 60.0 / 60.0 - 360.0 / 60.0 / 60.0 / 12.0;
double s_h = 360.0 / 60.0 - 360.0 / 60.0 / 60.0 / 12.0;
double maxt = 60.0 * 60.0 * 12.0;
double D;
int numEndpoint;
bool cmp(Endpoint a, Endpoint b) { return a.pos < b.pos; }
void buildInterval(double v)
{
int k = 0;
while((k * 360.0 + D) / v <= maxt)
{
endpoint[numEndpoint].pos = (k * 360.0 + D) / v;
endpoint[numEndpoint++].k = 1;
endpoint[numEndpoint].pos = min(maxt, (k * 360.0 + 360.0 - D) / v);
endpoint[numEndpoint++].k = -1;
//printf("%d\n", numEndpoint);
k++;
}
}
double intersection()
{
int in = 0, i, ok = 0;
double ans = 0.0;
double l;
for(i=0; i < numEndpoint; i++)
{
in += endpoint[i].k;
if(in == 3)
{
l=endpoint[i].pos;
ok=1;
}
else if(ok)
{
ans += endpoint[i].pos - l;
ok=0;
}
}
return ans;
}
int main()
{
while(scanf("%lf", &D), D > -0.1)
{
//printf("%f\n",D);
numEndpoint = 0;
buildInterval(s_m);
buildInterval(m_h);
buildInterval(s_h);
sort(endpoint, endpoint + numEndpoint, cmp);
//for(int i = 0; i < numEndpoint; i++) printf("i=%d %f %d\n", i, endpoint[i].pos, endpoint[i].k);
printf("%.3f\n", intersection() / maxt * 100.0);
}
return 0;
}