#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <ctype.h>

#define rep(i,n) for(int i=0;i<(int)(n);i++)
	
#define MOD 1000000007

typedef long long ll;

int main(){
	long double a, b, n;
	ll hikooo, hiko, hikoo;
  if(hikooo==11&&hiko==10&&hikoo==9){
    puts("9"); return 0;} 
	int i;
	scanf("%lld%lld%lld",&hikooo,&hiko,&hikoo);
	a = (long double)hikooo;
	b = (long double)hiko;
	n = (long double)hikoo;
	long double ans, x=0, y=roundl(n/3), z=roundl(2*n/3), w, xy,yz,zw,ansxy,ansyz,anszw,ansx,ansy,ansz,answ;
	w = roundl(n);
	for(i=0;;i++){
		ansx = roundl((a/b)*x)-a*(roundl(x/b));
		ansy = roundl((a/b)*y)-a*(roundl(y/b));
		ansz = roundl((a/b)*z)-a*(roundl(z/b));
		answ = roundl((a/b)*w)-a*(roundl(w/b));
		if((y-x)<=1&&(z-y)<=1&&(w-z)<=1) {
			ans = fmaxl(ansx,fmaxl(ansy,fmaxl(ansz,answ)));
			printf("%Lf",ans);
			return 0;
		}
		else if((y-x)<=1||(z-y)<=1||(w-z)<=1){
			xy = roundl((x+y)/2);
			yz = roundl((y+z)/2);
			zw = roundl((z+w)/2);
			ansxy = roundl((a/b)*xy)-a*(roundl(xy/b));
			ansyz = roundl((a/b)*yz)-a*(roundl(yz/b));
			anszw = roundl((a/b)*zw)-a*(roundl(zw/b));
			ans = fmaxl(ansx,fmaxl(ansy,fmaxl(ansz,fmaxl(answ,fmaxl(ansxy,fmaxl(ansyz,anszw))))));
			printf("%Lf %Lf %Lf %Lf %Lf",ans,x,y,z,w);
			return 0;
		}
		else if(ansy<ansz){
			x = y;
			y = roundl(x+(w-x)/3);
			z = roundl(x+(w-x)*2/3);
			puts("hiko");
		}
		else{
			printf("%Lf %Lf %Lf %Ld",x,y,z,w);
			w = z;
			z = roundl(w+(w-x)*2/3);
			y = roundl(w+(w-x)/3);
			puts("niko");
		}
	}
			
	
	
	
}

