n=int(input())
ar=[int(input()) for i in range(n)]
if(len(set(ar))==1):
    print("Exemplary pages.")
    quit()
if(len(set(ar))!=3):
    print("Unrecoverable configuration.")
    quit()
mn=min(ar)
mx=max(ar)
mni=ar.index(mn)
mxi=ar.index(mx)
vl=(mx-mn)//2
ar[mni]+=vl
ar[mxi]-=vl
if(len(set(ar))==1):
    print(str(vl)+" ml. from cup #"+str(mni+1)+" to cup #"+str(mxi+1)+".")
    quit()
else:
    print("Unrecoverable configuration.")
    quit()


n = int(input())
juice = []
for i in range(n):
    x = int(input())
    juice.append(x)
sums = 0
for drink in juice:
    sums += drink
a = sums/len(juice)
if a == int(a):
    if juice.count(juice[0]) == len(juice):
        ans = "Exemplary pages."
    else:
        if juice.count(a) == len(juice)-2:
            drink1 = 0
            drink2 = 0
            drink1ind = 0
            drink2ind = 0
            done = False
            count = 0
            for drink in juice:
                if drink != a:
                    if done == True:
                        drink2 = drink
                        drink2ind=count
                    else:
                        drink1 = drink
                        drink1ind = count
                        done = True
                count += 1
            b = drink2-drink1
            c = b/2
            if drink1 < drink2:
                ans = str(c) + " ml. from cup #" + str(drink1ind+1) + " to cup #" + str(drink2ind+1)
            else:
                ans = str(-c) + " ml. from cup #" + str(drink2ind+1) + " to cup #" + str(drink1ind+1)
        else:
            ans = "Unrecoverable configuration."
else:
    ans = "Unrecoverable configuration."
print(ans)


n = int(input())
juice = []
for i in range(n):
    x = int(input())
    juice.append(x)
sums = 0
for drink in juice:
    sums += drink
a = sums/len(juice)
if a == int(a):
    if juice.count(juice[0]) == len(juice):
        ans = "Exemplary pages."
    else:
        if juice.count(a) == len(juice)-2:
            drink1 = 0
            drink2 = 0
            drink1ind = 0
            drink2ind = 0
            done = False
            count = 0
            for drink in juice:
                if drink != a:
                    if done == True:
                        drink2 = drink
                        drink2ind=count
                    else:
                        drink1 = drink
                        drink1ind = count
                        done = True
                count += 1
            b = drink2-drink1
            c = b/2
            if drink1 < drink2:
                ans = str(int(c)) + " ml. from cup #" + str(drink1ind+1) + " to cup #" + str(drink2ind+1)
            else:
                ans = str(int(-c)) + " ml. from cup #" + str(drink2ind+1) + " to cup #" + str(drink1ind+1)
        else:
            ans = "Unrecoverable configuration."
else:
    ans = "Unrecoverable configuration."
print(ans)


n = int(input())
juice = []
for i in range(n):
    x = int(input())
    juice.append(x)
sums = 0
for drink in juice:
    sums += drink
a = sums/len(juice)
if a == int(a):
    if juice.count(juice[0]) == len(juice):
        ans = "Exemplary pages."
    else:
        if juice.count(a) == len(juice)-2:
            drink1 = 0
            drink2 = 0
            drink1ind = 0
            drink2ind = 0
            done = False
            count = 0
            for drink in juice:
                if drink != a:
                    if done == True:
                        drink2 = drink
                        drink2ind=count
                    else:
                        drink1 = drink
                        drink1ind = count
                        done = True
                count += 1
            b = drink2-drink1
            c = b/2
            if drink1 < drink2:
                ans = str(int(c)) + " ml. from cup #" + str(drink1ind+1) + " to cup #" + str(drink2ind+1) + "."
            else:
                ans = str(int(-c)) + " ml. from cup #" + str(drink2ind+1) + " to cup #" + str(drink1ind+1) + "."
        else:
            ans = "Unrecoverable configuration."
else:
    ans = "Unrecoverable configuration."
print(ans)


c = sorted((int(input()), i + 1) for i in range(int(input())))
if c[0][0] == c[-1][0]:
    print('Exemplary pages.')
elif (c[0][0] + c[-1][0]) % 2:
    print('Unrecoverable configuration.')
else:
    a = (c[0][0] + c[-1][0]) // 2
    if len(c) > 2 and (a != c[1][0] or a != c[-2][0]):
        print('Unrecoverable configuration.')
    else:
        print(a - c[0][0], ' ml. from cup #', c[0][1], ' to cup #', c[-1][1], '.', sep='')


n = int(input())
a = []
sum = 0
for i in range(n):
    x = int(input())
    sum += x
    a.append(x)
ave = sum / n
if int(ave) == ave:
    ave = int(ave)
    b = set()
    cnt = 0
    for i in range(n):
        if abs(ave - a[i])!=0:
            b.add(abs(ave - a[i]))
            t = ave - a[i]
            if t > 0:
                A = i + 1
            else:
                B = i + 1
            cnt += 1
    if len(b) == 0:
        print("Exemplary pages.")
    elif len(b) == 1 and cnt == 2:
        print(str(abs(t)) + " ml. from cup #" + str(A) + " to cup #" + str(B) + ".")
    else:
        print("Unrecoverable configuration.")
else:
    print('Unrecoverable configuration.')#2020-03-22 17:08:28.1


lst=[]
for _ in range(int(input())):
    lst.append(int(input()))
if sum(lst)%len(lst)!=0:
    print("Unrecoverable configuration.")
else:
    ave=sum(lst)//len(lst)
    lst=list(map(lambda x: x-ave,lst))
    l1=list(filter(lambda x: x[1]>0,enumerate(lst)))
    l2=list(filter(lambda x: x[1]<0,enumerate(lst)))
    if l1==[] and l2==[]:
        print("Exemplary pages.")
    elif len(l1)>1 or len(l2)>1:
        print("Unrecoverable configuration.")
    else:
        print(f'{l1[0][1]} ml. from cup #{l2[0][0]+1} to cup #{l1[0][0]+1}.')


n = int(input())
a = []
sum = 0
for i in range(n):
    x = int(input())
    sum += x
    a.append(x)
ave = sum / n
if int(ave) == ave:
    ave = int(ave)
    b = set()
    cnt = 0
    for i in range(n):
        if abs(ave - a[i])!=0:
            b.add(abs(ave - a[i]))
            t = ave - a[i]
            if t > 0:
                A = i + 1
            else:
                B = i + 1
            cnt += 1
    if len(b) == 1 and cnt == 2:
        print(str(abs(t)) + " ml. from cup #" + str(A) +" to cup #" + str(B) + ".")
    elif len(b) == 0:
        print("Exemplary pages.")
    else:
        print("Unrecoverable configuration.")
else:
    print('Unrecoverable configuration.')


p, n = {}, int(input())
for i in range(1, n + 1):
    t = input()
    if t in p:
        if p[t]: p[t] = 0
    else:
        p[t] = i
        if len(p) > 3: break
if len(p) == 1: print('Exemplary pages.')
elif len(p) > 3: print('Unrecoverable configuration.')
elif len(p) == 2:
    if n > 2: print('Unrecoverable configuration.')
    else:
        a, c = sorted((int(i), j) for i, j in p.items())
        if (a[0] + c[0]) & 1: print('Unrecoverable configuration.')
        else:
            b = (a[0] + c[0]) // 2
            print(str(c[0] - b) + ' ml. from cup #' + str(a[1]), 'to cup #' + str(c[1]) + '.')

else:
    p = {j: int(i) for i, j in p.items()}
    if len(p) < 3: print('Unrecoverable configuration.')
    else:
        a, b, c = sorted((j, i) for i, j in p.items())
        if not (a[1] and c[1]) or a[0] + c[0] - 2 * b[0]: print('Unrecoverable configuration.')
        else: print(str(c[0] - b[0]) + ' ml. from cup #' + str(a[1]), 'to cup #' + str(c[1]) + '.')


p = {}
for i in range(1, int(input()) + 1):
    t = input()
    if t in p:
        if p[t]: p[t] = 0
    else:
        p[t] = i
        if len(p) > 3: break
if len(p) == 1: print('Exemplary pages.')
elif len(p) > 3 or len(p) == 2: print('Unrecoverable configuration.')
else:
    p = {j: int(i) for i, j in p.items()}
    if len(p) < 3: print('Unrecoverable configuration.')
    else:
        a, b, c = sorted((j, i) for i, j in p.items())
        if not (a[1] and c[1]) or a[0] + c[0] - 2 * b[0]: print('Unrecoverable configuration.')
        else: print(str(c[0] - b[0]) + ' ml. from cup #' + str(a[1]), 'to cup #' + str(c[1]) + '.')


c = sorted((int(input()), i + 1) for i in range(int(input())))

if c[0][0] == c[-1][0]:

    print('Exemplary pages.')

elif (c[0][0] + c[-1][0]) % 2:

    print('Unrecoverable configuration.')

else:

    a = (c[0][0] + c[-1][0]) // 2

    if len(c) > 2 and (a != c[1][0] or a != c[-2][0]):

        print('Unrecoverable configuration.')

    else:

        print(a - c[0][0], ' ml. from cup #', c[0][1], ' to cup #', c[-1][1], '.', sep='')

# Made By Mostafa_Khaled


n = int(input())

arr = []

for i in range(0, n):
  arr.append((int(input()), i+1))

sorted_arr = sorted(arr, key=lambda x: x[0])

Checker = dict()

for i in sorted_arr:
  Checker[i[0]] = 0

for i in sorted_arr:
  Checker[i[0]] = Checker[i[0]] + 1
if(len(Checker) == 1):
  print("Exemplary pages.")
elif(len(Checker) == 2):
  if(abs(sorted_arr[0][0] - sorted_arr[1][0])%2 == 0):
    print(str(int(abs(sorted_arr[0][0] - sorted_arr[1][0])/2)) + " ml. from cup #" + str(sorted_arr[0][1]) + " to cup #" + str(sorted_arr[n-1][1]) +".")
  else:
    print("Unrecoverable configuration.")
elif (len(Checker) == 3) :
  val = sorted_arr[int((n-1)/2)][0] - sorted_arr[0][0]

  print(str(val) + " ml. from cup #" + str(sorted_arr[0][1]) + " to cup #" + str(sorted_arr[n-1][1]) + ".")

else:
  print("Unrecoverable configuration.")


n = int(input())

arr = []

for i in range(0, n):
  arr.append((int(input()), i+1))

sorted_arr = sorted(arr, key=lambda x: x[0])

Checker = dict()

for i in sorted_arr:
  Checker[i[0]] = 0

for i in sorted_arr:
  Checker[i[0]] = Checker[i[0]] + 1
if(len(Checker) == 1):
  print("Exemplary pages.")
elif(len(sorted_arr) == 2):
  if(abs(sorted_arr[0][0] - sorted_arr[1][0])%2 == 0):
    print(str(int(abs(sorted_arr[0][0] - sorted_arr[1][0])/2)) + " ml. from cup #" + str(sorted_arr[0][1]) + " to cup #" + str(sorted_arr[n-1][1]) +".")
  else:
    print("Unrecoverable configuration.")
elif (len(sorted_arr) == 3) :
  a = sorted_arr[0][0] + sorted_arr[1][0] + sorted_arr[2][0]
  if (a%3 != 0):
    print("Unrecoverable configuration.")
  else:
    print(str(a/3) + " ml. from cup #" + str(sorted_arr[0][1]) + " to cup #" + str(sorted_arr[n-1][1]) + ".")

elif(len(Checker) == 3):
  run_sum = sum([a[0] for a in sorted_arr])

  if (run_sum % n != 0):
    print("Unrecoverable configuration.")
  else:
    print(str(sorted_arr[n-1][0] - int(run_sum/n)) + " ml. from cup #" + str(sorted_arr[0][1]) + " to cup #" + str(sorted_arr[n-1][1]) + ".")

else:
  print("Unrecoverable configuration.")


n = int(input())

arr = []

for i in range(0, n):
  arr.append((int(input()), i+1))

sorted_arr = sorted(arr, key=lambda x: x[0])

Checker = dict()

for i in sorted_arr:
  Checker[i[0]] = 0

for i in sorted_arr:
  Checker[i[0]] = Checker[i[0]] + 1

if(len(Checker) == 1):
  print("Exemplary pages.")
elif(len(Checker) == 2 and sorted_arr[0] != 0 and sorted_arr[1] !=0):
    val = sorted_arr[1][0] - sorted_arr[0][0]

    print(str(val) + " ml. from cup #" + str(sorted_arr[0][1]) + " to cup #" + str(sorted_arr[n-1][1]) +".")
elif (len(Checker) == 3) :
  val = sorted_arr[int((n-1)/2)][0] - sorted_arr[0][0]

  print(str(val) + " ml. from cup #" + str(sorted_arr[0][1]) + " to cup #" + str(sorted_arr[n-1][1]) + ".")

else:
  print("Unrecoverable configuration.")


n = int(input())

arr = []

for i in range(0, n):
  arr.append((int(input()), i+1))

sorted_arr = sorted(arr, key=lambda x: x[0])

Checker = dict()

for i in sorted_arr:
  Checker[i[0]] = 0

for i in sorted_arr:
  Checker[i[0]] = Checker[i[0]] + 1
if(len(Checker) == 1):
  print("Exemplary pages.")
elif(len(sorted_arr) == 2):
  if(abs(sorted_arr[0][0] - sorted_arr[1][0])%2 == 0):
    print(str(int(abs(sorted_arr[0][0] - sorted_arr[1][0])/2)) + " ml. from cup #" + str(sorted_arr[0][1]) + " to cup #" + str(sorted_arr[n-1][1]) +".")
  else:
    print("Unrecoverable configuration.")
elif (len(sorted_arr) == 3) :
  a = sorted_arr[0][0] + sorted_arr[1][0] + sorted_arr[2][0]
  if (a%3 != 0):
    print("Unrecoverable configuration.")
  else:
    print(str(a/3) + " ml. from cup #" + str(sorted_arr[0][1]) + " to cup #" + str(sorted_arr[n-1][1]) + ".")

else:
  print("Unrecoverable configuration.")


n = int(input())

arr = []

for i in range(0, n):
  arr.append((int(input()), i+1))

sorted_arr = sorted(arr, key=lambda x: x[0])

Checker = dict()

for i in sorted_arr:
  Checker[i[0]] = 0

for i in sorted_arr:
  Checker[i[0]] = Checker[i[0]] + 1
if(len(Checker) == 1):
  print("Exemplary pages.")
elif(len(Checker) == 2):
  if (sorted_arr[0][0] == 0) :
    if sorted_arr[1][0] % 2 == 0:
      print(str(sorted_arr[1][0]/2) + " ml. from cup #" + str(sorted_arr[0][1]) + " to cup #" + str(sorted_arr[n-1][1]) +".")
    else:
      print("Unrecoverable configuration.")
  elif (sorted_arr[1][0] == 0) :
    if sorted_arr[0][0] % 2 == 0:
      print(str(sorted_arr[0][0]/2) + " ml. from cup #" + str(sorted_arr[0][1]) + " to cup #" + str(sorted_arr[n-1][1]) +".")
    else:
      print("Unrecoverable configuration.")
  else:
    val = sorted_arr[1][0] - sorted_arr[0][0]
    print(str(val) + " ml. from cup #" + str(sorted_arr[0][1]) + " to cup #" + str(sorted_arr[n-1][1]) +".")
elif (len(Checker) == 3) :
  val = sorted_arr[int((n-1)/2)][0] - sorted_arr[0][0]

  print(str(val) + " ml. from cup #" + str(sorted_arr[0][1]) + " to cup #" + str(sorted_arr[n-1][1]) + ".")

else:
  print("Unrecoverable configuration.")


n = int(input())

arr = []

for i in range(0, n):
  arr.append((int(input()), i+1))

sorted_arr = sorted(arr, key=lambda x: x[0])

Checker = dict()

for i in sorted_arr:
  Checker[i[0]] = 0

for i in sorted_arr:
  Checker[i[0]] = Checker[i[0]] + 1
if(len(Checker) == 1):
  print("Exemplary pages.")
elif(len(Checker) == 2):
  if(abs(sorted_arr[0][0] - sorted_arr[1][0])%2 == 0):
    print(str(int(abs(sorted_arr[0][0] - sorted_arr[1][0])/2)) + " ml. from cup #" + str(sorted_arr[0][1]) + " to cup #" + str(sorted_arr[n-1][1]) +".")
  else:
    print("Unrecoverable configuration.")
elif (len(Checker) == 3) :
  if (sorted_arr[0][0] == 0 and sorted_arr[1][0] == 0):
    print("Unrecoverable configuration.")
  else:
    val = sorted_arr[int((n-1)/2)][0] - sorted_arr[0][0]

    print(str(val) + " ml. from cup #" + str(sorted_arr[0][1]) + " to cup #" + str(sorted_arr[n-1][1]) + ".")

else:
  print("Unrecoverable configuration.")


n = int(input())

arr = []

for i in range(0, n):
  arr.append((int(input()), i+1))

sorted_arr = sorted(arr, key=lambda x: x[0])

Checker = dict()

for i in sorted_arr:
  Checker[i[0]] = 0

for i in sorted_arr:
  Checker[i[0]] = Checker[i[0]] + 1

if(len(Checker) == 1):
  print("Exemplary pages.")
elif(len(Checker) == 2):
    val = sorted_arr[1][0] - sorted_arr[0][0]

    print(str(val) + " ml. from cup #" + str(sorted_arr[0][1]) + " to cup #" + str(sorted_arr[n-1][1]))
elif (len(Checker) == 3) :
  val = sorted_arr[int((n-1)/2)][0] - sorted_arr[0][0]

  print(str(val) + " ml. from cup #" + str(sorted_arr[0][1]) + " to cup #" + str(sorted_arr[n-1][1]))

elif (len(Checker) > 3):
  print("Unrecoverable configuration.")


n = int(input())

arr = []

for i in range(0, n):
  arr.append((int(input()), i+1))

sorted_arr = sorted(arr, key=lambda x: x[0])

Checker = dict()

for i in sorted_arr:
  Checker[i[0]] = 0

for i in sorted_arr:
  Checker[i[0]] = Checker[i[0]] + 1
if(len(Checker) == 1):
  print("Exemplary pages.")
elif(len(Checker) == 2 and sorted_arr[0][0] != 0 and sorted_arr[1][0] !=0):
    val = sorted_arr[1][0] - sorted_arr[0][0]
    print(str(val) + " ml. from cup #" + str(sorted_arr[0][1]) + " to cup #" + str(sorted_arr[n-1][1]) +".")
elif (len(Checker) == 3) :
  val = sorted_arr[int((n-1)/2)][0] - sorted_arr[0][0]

  print(str(val) + " ml. from cup #" + str(sorted_arr[0][1]) + " to cup #" + str(sorted_arr[n-1][1]) + ".")

else:
  print("Unrecoverable configuration.")


import java.util.*;
import java.text.*;
import java.io.*;
import java.math.*;
public class code5 {
	InputStream is;
	PrintWriter out;
	static long mod=pow(10,9)+7;
	static int dx[]={0,0,1,-1},dy[]={1,-1,0,0};
	void solve() throws IOException
	{
		double k=nd();
		double d=nd();
		double t=nd();
		double low=0,high=2*10e18,ans=-1;
		for(int i=0;i<500;i++)
		{
			double mid=low+(high-low)/2;
			if(check(k,d,t,mid))
			{
				high=mid-1e-9;
				ans=mid;
			}else
				low=mid+1e-9;
		}
		out.println(ans);
	}
	boolean check(double k,double d,double t,double mid)
	{
		double ceil=k/d;
		if(ceil%1!=0)
			ceil++;
		ceil=(long)ceil*d;
		//System.out.println(ceil);
		double times=Math.floor(mid/ceil);
		double t1=Math.min(k,mid-times*ceil);
		double totalt=t1+times*k;
		//System.out.println(totalt);
		double t2=Math.max(0,mid-times*ceil-t1);
		double total2t=(t2+times*(ceil-k))/2;
		//System.out.println(total2t);
		return totalt+total2t>=t;
	}
	long ncr[][];
	int small[];
	void pre(int n)
	{
		small=new int[n+1];
		for(int i=2;i*i<=n;i++)

		{
			for(int j=i;j*i<=n;j++)
			{
				if(small[i*j]==0)
					small[i*j]=i;
			}
		}
		for(int i=0;i<=n;i++)
		{
			if(small[i]==0)
				small[i]=i;
		}
	}
	int sum(int i)
	{
		int sum=0;
		while(i!=0)
		{
			if((i%10)%2==1)
				sum+=i%10;
			i/=10;
		}
		return sum;
	}
	ArrayList<Integer> al[];
 	void take(int n,int m)
 	{
 		al=new ArrayList[n];
 		for(int i=0;i<n;i++)
 			al[i]=new ArrayList<Integer>();
 		for(int i=0;i<m;i++)
 		{
 			int x=ni();
 			int y=ni();
 			al[x].add(y);
 			al[y].add(x);
 		}
 	}
 	int check(long n)
 	{
 		int count=0;
 		while(n!=0)
 		{
 			if(n%10!=0)
 				break;
 			n/=10;
 			count++;
 		}
 		return count;
 	}
	public static int count(int x)
	{
		int num=0;
		while(x!=0)
		{
			x=x&(x-1);
			num++;
		}
		return num;
	}
	static long d, x, y;
	void extendedEuclid(long A, long B) {
	    if(B == 0) {
	        d = A;
	        x = 1;
	        y = 0;
	    }
	    else {
	        extendedEuclid(B, A%B);
	        long temp = x;
	        x = y;
	        y = temp - (A/B)*y;
	    }
	}
	long modInverse(long A,long M) //A and M are coprime
	{
	    extendedEuclid(A,M);
	    return (x%M+M)%M;    //x may be negative
	}
	public static void mergeSort(int[] arr, int l ,int r){
		if((r-l)>=1){
			int mid = (l+r)/2;
			mergeSort(arr,l,mid);
			mergeSort(arr,mid+1,r);
			merge(arr,l,r,mid);
		}
	}
	public static void merge(int arr[], int l, int r, int mid){
		int n1 = (mid-l+1), n2 = (r-mid);
		int left[] = new int[n1];
		int right[] = new int[n2];
		for(int i =0 ;i<n1;i++) left[i] = arr[l+i];
		for(int i =0 ;i<n2;i++) right[i] = arr[mid+1+i];
		int i =0, j =0, k = l;
		while(i<n1 && j<n2){
			if(left[i]>right[j]){
				arr[k++] = right[j++];
			}
			else{
				arr[k++] = left[i++];
			}
		}
		while(i<n1) arr[k++] = left[i++];
		while(j<n2) arr[k++] = right[j++];
	}
	public static void mergeSort(long[] arr, int l ,int r){
		if((r-l)>=1){
			int mid = (l+r)/2;
			mergeSort(arr,l,mid);
			mergeSort(arr,mid+1,r);
			merge(arr,l,r,mid);
		}
	}
	public static void merge(long arr[], int l, int r, int mid){
		int n1 = (mid-l+1), n2 = (r-mid);
		long left[] = new long[n1];
		long right[] = new long[n2];
		for(int i =0 ;i<n1;i++) left[i] = arr[l+i];
		for(int i =0 ;i<n2;i++) right[i] = arr[mid+1+i];
		int i =0, j =0, k = l;
		while(i<n1 && j<n2){
			if(left[i]>right[j]){
				arr[k++] = right[j++];
			}
			else{
				arr[k++] = left[i++];
			}
		}
		while(i<n1) arr[k++] = left[i++];
		while(j<n2) arr[k++] = right[j++];
	}
	 static class Pair implements Comparable<Pair>{

	       int x,y,k;
	       int i,dir;
	       long val;
		Pair (int x,long val){
			this.x=x;
			this.val=val;
		}
		public int compareTo(Pair o) {
			return Long.compare(this.val,o.val);
		}

		public String toString(){
			return x+" "+y+" "+k+" "+i+" "+val;}
		public boolean equals(Object o) {
			if (o instanceof Pair) {
				Pair p = (Pair)o;
				return p.x == x && p.y == y;
			}
			return false;
		}
		public int hashCode() {
			return new Long(x).hashCode()*31 + new Long(y).hashCode() ;
		}
	}

	    public static boolean isPal(String s){
	        for(int i=0, j=s.length()-1;i<=j;i++,j--){
	                if(s.charAt(i)!=s.charAt(j)) return false;
	        }
	        return true;
	    }
	    public static String rev(String s){
			StringBuilder sb=new StringBuilder(s);
			sb.reverse();
			return sb.toString();
	    }

	    public static long gcd(long x,long y){
		if(y==0)
			return x;
		else
			return gcd(y,x%y);
	    }

	    public static int gcd(int x,int y){
	    	if(y==0)
	    		return x;
	    	return gcd(y,x%y);
	    }

	    public static long gcdExtended(long a,long b,long[] x){

	        if(a==0){
	            x[0]=0;
	            x[1]=1;
	            return b;
	        }
	        long[] y=new long[2];
	        long gcd=gcdExtended(b%a, a, y);

	        x[0]=y[1]-(b/a)*y[0];
	        x[1]=y[0];

	        return gcd;
	    }

	    public static int abs(int a,int b){
		return (int)Math.abs(a-b);
	    }

	    public static long abs(long a,long b){
		return (long)Math.abs(a-b);
	    }

	    public static int max(int a,int b){
		if(a>b)
			return a;
		else
			return b;
	    }

	    public static int min(int a,int b){
		if(a>b)
			return b;
		else
			return a;
	    }

	    public static long max(long a,long b){
		if(a>b)
			return a;
		else
			return b;
	    }

	    public static long min(long a,long b){
		if(a>b)
			return b;
		else
			return a;
	    }

	    public static long pow(long n,long p,long m){
		 long  result = 1;
		  if(p==0)
		    return 1;
		if (p==1)
		    return n;
		while(p!=0)
		{
		    if(p%2==1)
		        result *= n;
		    if(result>=m)
		    result%=m;
		    p >>=1;
		    n*=n;
		    if(n>=m)
		    n%=m;
		}
		return result;
	    }

	    public static long pow(long n,long p){
		long  result = 1;
		  if(p==0)
		    return 1;
		if (p==1)
		    return n;
		while(p!=0)
		{
		    if(p%2==1)
		        result *= n;
		    p >>=1;
		    n*=n;
		}
		return result;
	    }
	    public static void debug(Object... o) {
			System.out.println(Arrays.deepToString(o));
		}
	    void run() throws Exception {
			is = System.in;
			out = new PrintWriter(System.out);
			solve();
			out.flush();
		}

	    public static void main(String[] args) throws Exception {
			new Thread(null, new Runnable() {
				public void run() {
					try {
						new code5().run();
					} catch (Exception e) {
						e.printStackTrace();
					}
				}
			}, "1", 1 << 26).start();

	    	//new code5().run();
		}
	    private byte[] inbuf = new byte[1024];
		public int lenbuf = 0, ptrbuf = 0;

		private int readByte() {
			if (lenbuf == -1)
				throw new InputMismatchException();
			if (ptrbuf >= lenbuf) {
				ptrbuf = 0;
				try {
					lenbuf = is.read(inbuf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return -1;
			}
			return inbuf[ptrbuf++];
		}

		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		private int skip() {
			int b;
			while ((b = readByte()) != -1 && isSpaceChar(b));
			return b;
		}

		private double nd() {
			return Double.parseDouble(ns());
		}

		private char nc() {
			return (char) skip();
		}

		private String ns() {
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		private char[] ns(int n) {
			char[] buf = new char[n];
			int b = skip(), p = 0;
			while (p < n && !(isSpaceChar(b))) {
				buf[p++] = (char) b;
				b = readByte();
			}
			return n == p ? buf : Arrays.copyOf(buf, p);
		}

		private char[][] nm(int n, int m) {
			char[][] map = new char[n][];
			for (int i = 0; i < n; i++)
				map[i] = ns(m);
			return map;
		}

		private int[] na(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = ni();
			return a;
		}
		private long[] nl(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nl();
			return a;
		}

		private int ni() {
			int num = 0, b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		private long nl() {
			long num = 0;
			int b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

}


import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;

public class maxwidth {
    static int arr[] ;

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        long k=in.nextLong();
        long d = in.nextLong();
        long t = in.nextLong();

            long slote_time=k/d;
            if(k%d!=0) {
                slote_time++;
                slote_time = slote_time * d;
                long not_hot_time_per_slote = slote_time - k;
                //System.out.println(not_hot_time_per_slote);
                double work_per_slote = k + (double) not_hot_time_per_slote / 2;
              //  System.out.println(work_per_slote);
                long ful_slotes = (long) (t / work_per_slote);
               // System.out.println(ful_slotes);
                double remaining = t - (work_per_slote * ful_slotes);
                //System.out.println(remaining);
                if (remaining > k) {
                    System.out.println(ful_slotes * slote_time + k + 2 * (remaining - k));
                } else {
                    System.out.println(ful_slotes * slote_time + remaining);
                }
            }else{
                System.out.println(t);
            }

    }

}


import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;

public class maxwidth {
    static int arr[] ;

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        long k=in.nextLong();
        long d = in.nextLong();
        long t = in.nextLong();

            long slote_time=k/d;
            if(k%d!=0) {
                slote_time++;
                slote_time = slote_time * d;
                long not_hot_time_per_slote = slote_time - k;
                //System.out.println(not_hot_time_per_slote);
                float work_per_slote = k + (float) not_hot_time_per_slote / 2;
              //  System.out.println(work_per_slote);
                long ful_slotes = (long) (t / work_per_slote);
               // System.out.println(ful_slotes);
                float remaining = t - (work_per_slote * ful_slotes);
                //System.out.println(remaining);
                if (remaining > k) {
                    System.out.println(ful_slotes * slote_time + k + 2 * (remaining - k));
                } else {
                    System.out.println(ful_slotes * slote_time + remaining);
                }
            }else{
                System.out.println(t);
            }

    }

}


import java.io.*;
import java.util.*;

public class TaskC {
    public static void main(String[] args) {
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        Solve solve = new Solve();
        solve.solve(in, out);
        out.close();
    }

    private static class Solve {

        public void solve(InputReader in, PrintWriter out) {
            long k = in.nextLong();
            long d = in.nextLong();
            long t = in.nextLong();
            long dTime = d - k % d;
            if (k % d == 0) {
                out.print(t);
                return;
            }
            long answerTime = dTime + k;
            long timePerStep = 2 * k + dTime;
            answerTime *= (2 * t) / timePerStep;
            long rem = 2 * t % timePerStep;
            if (rem == 0) {
                out.print(answerTime);
                return;
            }
            if (rem <= 2*k) {
                out.print(answerTime + rem * 0.5);
                return;
            } else {
                rem -= 2*k;
                out.println( answerTime + k + rem * 0.25);
            }
//            out.print(0.5D * (answer + rem));
        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}


import java.io.*;
import java.util.*;

public class TaskC {
    public static void main(String[] args) {
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        Solve solve = new Solve();
        solve.solve(in, out);
        out.close();
    }

    private static class Solve {

        public void solve(InputReader in, PrintWriter out) {
            long k = in.nextLong();
            long d = in.nextLong();
            long t = in.nextLong();
            long dTime = k - (k / d) * d;
            if (k % d == 0) {
                out.print(t);
                return;
            }
            long timePerStep = 2 * k + dTime;
            long answer = ((long)(2 * t / timePerStep) * timePerStep);
            long rem = 2 * t % timePerStep;
            if (rem > 0) {
                answer += 2*k;
                rem = StrictMath.max(0, rem - 2*k);
            }
            answer += rem;
//            out.println(answer);
            out.print((1.0D * answer / 2));
        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}


import java.io.*;
import java.util.*;

public class TaskC {
    public static void main(String[] args) {
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        Solve solve = new Solve();
        solve.solve(in, out);
        out.close();
    }

    private static class Solve {

        public void solve(InputReader in, PrintWriter out) {
            long k = in.nextLong();
            long d = in.nextLong();
            long t = in.nextLong();
            long dTime = d - k % d;
            if (k % d == 0) {
                out.print(t);
                return;
            }
            long answerTime = dTime + k;
            long timePerStep = 2 * k + dTime;
            answerTime = ((2 * t) / timePerStep) * answerTime;
            long rem = 2 * t % timePerStep;
            if (rem == 0) {
                out.print(answerTime);
                return;
            }
            if (rem <= 2*k) {
                out.print(answerTime + rem * 0.5);
                return;
            }
            rem -= 2*k;
            out.println( answerTime + k + rem);
        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}


import java.io.*;
import java.util.*;

public class TaskC {
    public static void main(String[] args) {
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        Solve solve = new Solve();
        solve.solve(in, out);
        out.close();
    }

    private static class Solve {

        public void solve(InputReader in, PrintWriter out) {
            long k = in.nextLong();
            long d = in.nextLong();
            long t = in.nextLong();
            long dTime = (k / d + 1) * d - k;
            if (k % d == 0) {
                out.print(t);
                return;
            }
            long timePerStep = 2 * k + dTime;
            long answer = ((long)(2 * t / timePerStep) * timePerStep);
            long rem = 2 * t % timePerStep;
            if (rem > 0) {
                answer += 2*k;
                rem = StrictMath.max(0, rem - 2*k);
            }
            answer += rem;
//            out.println(answer);
            out.print((1.0D * answer / 2));
        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}


import java.io.*;
import java.util.*;

public class C {
    void solve() {
        long k = in.nextLong();
        long d = in.nextLong();
        long t = in.nextLong();
        double ans = 0;

        if (d == 1 || d == k) {
            out.println(t);
            return;
        }

        if (d < k) {
            d *= (k+d-1)/d;
        }

        if (d == k) {
            out.println(t);
            return;
        }

        long slower = d - k;
        double gain = k + slower*0.5;

        long cycles = (long)(t/gain);

        ans += cycles * d;

        double left = t - (gain * cycles);

        if (left <= k) {
            ans += left;
        } else {
            ans += k;
            left -= k;
            ans += left*2;
        }
        out.println(ans);
    }

    Scanner in;
    PrintWriter out;

    void run() {
        try {
            in = new Scanner(new File("A.in"));
            out = new PrintWriter(new File("A.out"));

            solve();

            out.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    void runIO() {

        in = new Scanner(System.in);
        out = new PrintWriter(System.out);

        solve();

        out.close();
    }

    class Scanner {
        BufferedReader br;
        StringTokenizer st;

        public Scanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public Scanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return null;
                st = new StringTokenizer(s);
            }
            return st.nextToken();
        }

        private boolean isSpaceChar(int c) {
            return !(c >= 33 && c <= 126);
        }

        private int skip() {
            int b;
            while ((b = read()) != -1 && isSpaceChar(b)) ;
            return b;
        }

        private int read() {
            int res = -1;
            try {
                res = br.read();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return res;
        }

        char[] nextCharArray(int size) {
            char[] buf = new char[size];
            int b = skip(), p = 0;
            while (p < size && !(isSpaceChar(b))) {
                buf[p++] = (char) b;
                b = read();
            }
            return size == p ? buf : Arrays.copyOf(buf, p);
        }

        char[][] nextCharMap(int n, int m) {
            char[][] map = new char[n][];
            for (int i = 0; i < n; i++) {
                map[i] = nextCharArray(m);
            }
            return map;
        }

        int[] na(int n) {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = in.nextInt();
            }
            return arr;
        }

        boolean hasMoreTokens() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return false;
                st = new StringTokenizer(s);
            }
            return true;
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }
    }

    public static void main(String[] args) {
        new C().runIO();
    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author vikas.k
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            long k = in.nextLong();
            long d = in.nextLong();
            long t = in.nextLong();

            boolean left = true;
            double time = 0.0;
            double already = 0.0;
            while (left) {
                double cooked = k / (double) t;
                if (already + cooked >= 1.0) {
                    time = time + (1.0 - already) * t;
                    left = false;
                    continue;
                }

                already += cooked;
                time += k;

                //out.println(time + " " + already);
                double timeOff = (time % d) == 0 ? 0 : (((long) (time / d) + 1) * d) - time;
                //out.println(timeOff);
                cooked = timeOff / (2 * (double) t);
                if (already + cooked >= 1.0) {
                    time = time + (1.0 - already) * t * 2;
                    left = false;
                    continue;
                }
                already += cooked;
                time += timeOff;
                //out.println(time + " " + already);
            }
            out.printf("%.8f\n", time);
        }

    }

    static class FastScanner {
        private BufferedReader bufferedReader;
        private StringTokenizer stringTokenizer;

        public FastScanner(InputStream inputStream) {
            bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
        }

        public String next() {
            if (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {
                try {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return stringTokenizer.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author vikas.k
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            long k = in.nextLong();
            long d = in.nextLong();
            long t = in.nextLong();

            if (k % d == 0 || k >= t) {
                out.println((double) t);
                return;
            }

            long timeOff = (((k / d) + 1) * d) - k;
            double process = k / (double) t + timeOff / (2 * (double) t);
            double tmp = process;
            double time = 0.0;
            //out.println(timeOff + " " + process);
            double rm = (long) (1 / process);
            time = rm * (timeOff + k);
            double already = rm * process;
            //out.println(already + " " + time);
            if (already + k / (double) t >= 1.0) {
                time += (1 - already) * t;
                out.print(time);
                return;
            }

            time += k;
            already += k / (double) t;
            //out.println(already + " " + time);
            time += (1 - already) * 2 * t;
            out.printf("%.8f\n", time);

        }

    }

    static class FastScanner {
        private BufferedReader bufferedReader;
        private StringTokenizer stringTokenizer;

        public FastScanner(InputStream inputStream) {
            bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
        }

        public String next() {
            if (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {
                try {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return stringTokenizer.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, Scanner sc, PrintWriter out) {
            long k = sc.nextLong(), d = sc.nextLong(), t = sc.nextLong();
            long cycleLength = d < k ? 2 * d : d;
            double timeForCycle = k + (cycleLength - k) / 2.0;
            long completeCycles = (long) (t / timeForCycle);
            double rem = t - completeCycles * timeForCycle;
            double res = (double) completeCycles * cycleLength;
            if (rem <= k) {
                res += rem;
            } else {
                res += k + (rem - k) * 2;
            }
            out.printf("%.10f\n", res);
        }

    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                }
                ;
            }
            return st.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, Scanner sc, PrintWriter out) {
            long k = sc.nextLong(), d = sc.nextLong(), t = sc.nextLong();
            long cycleLength = d * (k / d + 1);
            if (cycleLength - d >= k) cycleLength -= d;
            double timeForCycle = k + (cycleLength - k) / 2.0;
            long completeCycles = (long) (t / timeForCycle);
            double rem = t - completeCycles * timeForCycle;
            double res = (double) completeCycles * cycleLength;
            if (rem <= k) {
                res += rem;
            } else {
                res += k + (rem - k) * 2;
            }
            out.printf("%.10f\n", res);
        }

    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                }
                ;
            }
            return st.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}


import java.io.*;
import java.util.*;
public class A
{
	BufferedReader in;
	PrintWriter ob;
	StringTokenizer st;
	public static void main(String[] args) throws IOException {
		new A().run();
	}
	void run() throws IOException {
		//in=new BufferedReader(new FileReader("S:/Bday App/Codeforces/src/input.txt"));
		in=new BufferedReader(new InputStreamReader(System.in));
		ob=new PrintWriter(System.out);
		solve();
		ob.flush();
	}
	void solve() throws IOException {
		double k = 0 ,d = 0 ,t = 0;
		double kk = 0,dl = 0,dd = 0,tt = 0,tc = 0;
		double kectotal = 0,tnow = 0,ans = 0;
		double prnow = 0,kebnow = 0;
		k = nd();
		d = nd();
		t = nd();
	    kk = (long)Math.ceil(k/d);
	   	dd = kk*d;
	   	dl = dd-k;
	   	tt = 1/(2*t);
	   	tt = dl*tt;
	   	tc = k/t;
	   	kectotal = tt+tc;
	   	tnow = (long)Math.floor(1.0/kectotal);
	   	ans = (tnow*1L*dd);
	   	prnow = tnow*kectotal;
	   	kebnow = 1.0-prnow;
	   	if(kebnow <= 0.000000000) {}
	   	else if(kebnow <= tc){
	   		ans += ((kebnow/tc)*k);
	   		kebnow -= kebnow;
	   	}else if (kebnow > tc){
	   		ans += k;
	   		kebnow -= tc;
	   	}
	   	if(kebnow <= 0.000000000) {}
	   	else if(kebnow <= tt){
	   		ans += ((kebnow/tt)*dl);
	   		kebnow -= kebnow;
	   	}
	   	ob.printf("%.11f",ans);

	}
	String ns() throws IOException {
		return nextToken();
	}
	long nl() throws IOException {
		return Long.parseLong(nextToken());
	}
	int ni() throws IOException {
		return Integer.parseInt(nextToken());
	}
	double nd() throws IOException {
		return Double.parseDouble(nextToken());
	}
	String nextToken() throws IOException {
		if(st==null || !st.hasMoreTokens())
			st=new StringTokenizer(in.readLine());
		return st.nextToken();
	}
	int[] nia(int start,int b) throws IOException {
		int a[]=new int[b];
		for(int i=start;i<b;i++)
			a[i]=ni();
		return a;
	}
	long[] nla(int start,int n) throws IOException {
		long a[]=new long[n];
		for (int i=start; i<n ;i++ ) {
			a[i]=nl();
		}
		return a;
	}
}


import java.util.Scanner;

public class task937c {

    void run() {
        Scanner sc = new Scanner(System.in);
        long k = sc.nextLong();
        long d = sc.nextLong();
        long t = sc.nextLong();

        double answer = 0;
        long work = 2 * t;
        long cycle_time = d * (k / d + ((k % d != 0) ? 1 : 0));
        long cycle_speed = 2 * k + (cycle_time - k);

        answer = (int) (work / cycle_speed) * cycle_time;
        double to_end = work - (int) (work / cycle_speed) * cycle_speed;
        if (to_end <= 2 * k) {
            answer += to_end / 2;
        } else {
            answer += k + (to_end - 2 * k);
        }
        System.out.println(answer);
    }

    public static void main(String[] args) {
        new task937c().run();
    }

}


import java.util.Scanner;

public class task937c {

    void run() {
        Scanner sc = new Scanner(System.in);
        long k = sc.nextLong();
        long d = sc.nextLong();
        long t = sc.nextLong();

        double answer = 0;
        double work = 2 * t;
        long cycle_time = d * (k / d + ((k % d != 0) ? 1 : 0));
        long cycle_speed = 2 * k + (cycle_time - k);

        answer = (2 * t / cycle_speed) * cycle_time;
        double to_end = work - (2 * t / cycle_speed) * cycle_speed;
        if (to_end <= 2 * k) {
            answer += to_end / 2;
        } else {
            answer += k + (to_end - 2 * k);
        }
        System.out.printf("%18f\n", answer);
    }

    public static void main(String[] args) {
        new task937c().run();
    }

}


import java.util.Scanner;

public class task937c {

    void run() {
        Scanner sc = new Scanner(System.in);
        long k = sc.nextLong();
        long d = sc.nextLong();
        long t = sc.nextLong();

        double answer = 0;
        double work = 2 * t;
        long cycle_time = d * (k / d + ((k % d != 0) ? 1 : 0));
        long cycle_speed = 2 * k + (cycle_time - k);

        answer = (work / cycle_speed) * cycle_time;
        double to_end = work - (work / cycle_speed) * cycle_speed;
        if (to_end <= 2 * k) {
            answer += to_end / 2;
        } else {
            answer += k + (to_end - 2 * k);
        }
        System.out.printf("%10f\n", answer);
    }

    public static void main(String[] args) {
        new task937c().run();
    }

}


import java.util.Scanner;

public class task937c {

    void run() {
        Scanner sc = new Scanner(System.in);
        long k = sc.nextLong();
        long d = sc.nextLong();
        long t = sc.nextLong();

        double answer = 0;
        long work = 2 * t;
        long cycle_time = d * (k / d + ((k % d != 0) ? 1 : 0));
        long cycle_speed = 2 * k + (cycle_time - k);

        answer = (int) (work / cycle_speed) * cycle_time;
        double to_end = work - (int) (work / cycle_speed) * cycle_speed;
        if (to_end <= 2 * k) {
            answer += to_end / 2;
        } else {
            answer += k + (to_end - 2 * k);
        }
        System.out.printf("%10f\n", answer);
    }

    public static void main(String[] args) {
        new task937c().run();
    }

}


import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Scanner;

public class HelloWorld {
	static long totalDay = 0;
	static int k;

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		long k = scanner.nextLong();
		long d = scanner.nextLong();
		long t = scanner.nextLong();

		double result;
		long temp = k%d;
		long cycleInMin;
		double cyclePercentage;
		if (temp == 0) {
			cycleInMin = k;
			cyclePercentage = (double)k/t;
		}else {
			cycleInMin= k + (d-temp);
			cyclePercentage = (double)k/t + (double)(d-temp)/(2*t);
		}
		long numberFullCycle = (long) Math.floor(1/cyclePercentage);
		result = cycleInMin * numberFullCycle;
		double remainPercentage = 1- numberFullCycle*cyclePercentage;
		if (remainPercentage > (double)k/t) {
			result += k;
			remainPercentage = remainPercentage-(double)k/t;
			result += remainPercentage*2*t;
		}else {
			result += remainPercentage*t;
		}
		System.out.println(result);
	}

}


import java.util.*;
import java.io.*;
import java.math.*;

public class b {

    // Code starts Here
    // Global Variables
    public static Reader read = new Reader();
    public static long mod = 1000000000 + 7;

    public static void main(String[] args) throws Exception {

        double k,d,t;
        k = read.nextDouble();
        d = read.nextDouble();
        t = read.nextDouble();

        double ans = 0;

        if(t <= k ){
            ans = t;
        }else{
            double common = (long)Math.ceil(k/d)*d;
            double part = k + (common - k)/(2d);

            //System.out.println("comm"+common);
            //System.out.println("part:"+part);
            if(t <= part){
                ans = k + (t-k)*2;
            }else{
                double times = t/part;
                //System.out.println("times: "+times);
                common *= (long)times;
                //System.out.println("comm"+common);
                double left = t - ((long)times)*part;
                //System.out.println("left+ "+left);
                if(left>0){
                    if(left <= k){
                        ans += common +left;
                    }else{
                        ans += common + k + (left-k)*2;
                    }
                }else{
                    ans = common;
                }
            }
        }
        System.out.println(ans);
    }

    public static long modAdd(long a, long b) { return (a % mod + b % mod) % mod;}

    public static long modSub(long a, long b) { return ((a % mod - b % mod) % mod);}

    public static long modMul(long a, long b) { return ((a % mod) * (b % mod)) % mod;}

    public static long modDiv(long a, long b) { return ((a % mod) * (binaryExp(b, mod - 2))) % mod;}

    public static long modPow(long a) { return a % (mod - 1);}

    public static long binaryExp(long a, long pow) {
        a = a % mod;
        if (pow == 0) {
            return 1;
        } else if (pow == 1) {
            return a;
        } else {
            long half = pow / 2;
            long temp = binaryExp(a, half);
            if (pow % 2 == 0) {
                return (temp * temp) % mod;
            } else {
                return ((a % mod) * ((temp * temp) % mod)) % mod;
            }
        }
    }

    /* Code ends Here */

    static class Reader {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[100000+1]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');

            if (c == '.') {
                while ((c = read()) >= '0' && c <= '9') {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException {
            if (din == null)
                return;
            din.close();
        }
    }
}


import java.util.*;
public class C_467{
public static void main(String[] args)
{
   Scanner omkar = new Scanner(System.in);
   double k = omkar.nextDouble();
   double d = omkar.nextDouble();
   double t = omkar.nextDouble();
   double cookPerTurn = k + 0.5*(Math.ceil(k/d)*d-k);
   double minPerTurn = Math.ceil(k/d)*d;
   double leftOver = t % cookPerTurn;
   double total = 0;
   if(leftOver <= k)
   {
      total += leftOver;
   }
   else
   {
      total += k + 2*(leftOver - k);
   }
   total += Math.floor(t/cookPerTurn)*minPerTurn;
   System.out.println(total);
        }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class B {

    public static void main(String[] args) throws IOException {
        ReaderB.init(System.in);
        long k = ReaderB.nextLong();
        long d = ReaderB.nextLong();
        long t = ReaderB.nextLong();
        long a = (long) Math.ceil(k*1.0/d);
        long n = (2*t)/(k + a*d);
//        System.out.println(a);
        double rem = 1 - n*((k + a*d)/(2.0*t));
        double ans = 0.0;
//        System.out.println(rem);
        if (rem > k*1.0/t) {
            rem = rem - k*1.0/t;
            ans += 2*t*rem;
        }
        else ans += t*rem;
        ans += n*a*d;
        System.out.println(ans);
    }
}

/**
 * Reader class based on the article at "https://www.cpe.ku.ac.th/~jim/java-io.html"
 */
class ReaderB {
    private static BufferedReader reader;
    private static StringTokenizer tokenizer;

    static void init(InputStream inputStream) {
        reader = new BufferedReader(new InputStreamReader(inputStream));
        tokenizer = new StringTokenizer("");
    }

    static String next() throws IOException {
        String read;
        while (!tokenizer.hasMoreTokens()) {
            read = reader.readLine();
            if (read == null || read.equals(""))
                return "-1";
            tokenizer = new StringTokenizer(read);
        }

        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    //    Get a whole line.
    static String line() throws IOException {
        return reader.readLine();
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class B {

    public static void main(String[] args) throws IOException {
        ReaderB.init(System.in);
        long k = ReaderB.nextLong();
        long d = ReaderB.nextLong();
        long t = ReaderB.nextLong();
        long a = (long) Math.ceil(k*1.0/d);
        long n = (2*t)/(k + a*d);
//        System.out.println(a);
        double rem = 1 - n*((k + a*d)/(2.0*t));
        double ans = 0.0;
//        System.out.println(rem);
        if (rem > k*1.0/t) {
            ans += k*1.0/t;
            rem = rem - k*1.0/t;
            ans += 2*t*rem;
        }
        else ans += t*rem;
        ans += n*a*d;
        System.out.println(ans);
    }
}

/**
 * Reader class based on the article at "https://www.cpe.ku.ac.th/~jim/java-io.html"
 */
class ReaderB {
    private static BufferedReader reader;
    private static StringTokenizer tokenizer;

    static void init(InputStream inputStream) {
        reader = new BufferedReader(new InputStreamReader(inputStream));
        tokenizer = new StringTokenizer("");
    }

    static String next() throws IOException {
        String read;
        while (!tokenizer.hasMoreTokens()) {
            read = reader.readLine();
            if (read == null || read.equals(""))
                return "-1";
            tokenizer = new StringTokenizer(read);
        }

        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    //    Get a whole line.
    static String line() throws IOException {
        return reader.readLine();
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class B {

    public static void main(String[] args) throws IOException {
        ReaderB.init(System.in);
        long k = ReaderB.nextLong();
        long d = ReaderB.nextLong();
        long t = ReaderB.nextLong();
        long a = (long) Math.ceil(k*1.0/d);
        long n = (2*t)/(k + a*d);
//        System.out.println(a);
        double rem = 1 - n*((k + a*d)/(2.0*t));
        double ans = 0.0;
//        System.out.println(rem);
        if (rem > k*1.0/t) {
            ans += k;
            rem = rem - k*1.0/t;
            ans += 2*t*rem;
        }
        else ans += t*rem;
        ans += n*a*d;
        System.out.println(ans);
    }
}

/**
 * Reader class based on the article at "https://www.cpe.ku.ac.th/~jim/java-io.html"
 */
class ReaderB {
    private static BufferedReader reader;
    private static StringTokenizer tokenizer;

    static void init(InputStream inputStream) {
        reader = new BufferedReader(new InputStreamReader(inputStream));
        tokenizer = new StringTokenizer("");
    }

    static String next() throws IOException {
        String read;
        while (!tokenizer.hasMoreTokens()) {
            read = reader.readLine();
            if (read == null || read.equals(""))
                return "-1";
            tokenizer = new StringTokenizer(read);
        }

        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    //    Get a whole line.
    static String line() throws IOException {
        return reader.readLine();
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }
}