//AC过了的
#include
int main()
{
int n,i;
double sum;
scanf("%d",&n);
sum = n;
i = 1;
while(n != 1)
{
if(n % 2)
n = n * 3 + 1;
else
n /= 2;
sum += n;
i ++;
}
printf("%.3f",(double)sum/i);
return 0;
}
//AC过了的
#include
int main()
{
int n,i;
double sum;
scanf("%d",&n);
sum = n;
i = 1;
while(n != 1)
{
if(n % 2)
n = n * 3 + 1;
else
n /= 2;
sum += n;
i ++;
}
printf("%.3f",(double)sum/i);
return 0;
}