Problem: Julia is going to cook a chicken in the kitchen of her dormitory. To save energy, the stove in the kitchen automatically turns off after k minutes after turning on.

During cooking, Julia goes to the kitchen every d minutes and turns on the stove if it is turned off. While the cooker is turned off, it stays warm. The stove switches on and off instantly.

It is known that the chicken needs t minutes to be cooked on the stove, if it is turned on, and 2t minutes, if it is turned off. You need to find out, how much time will Julia have to cook the chicken, if it is considered that the chicken is cooked evenly, with constant speed when the stove is turned on and at a constant speed when it is turned off.

Input

The single line contains three integers k, d and t (1 ≤ k, d, t ≤ 1018).

Output

Print a single number, the total time of cooking in minutes. The relative or absolute error must not exceed 10 - 9.

Namely, let's assume that your answer is x and the answer of the jury is y. The checker program will consider your answer correct if <image>.

Examples

Input

3 2 6


Output

6.5


Input

4 2 20


Output

20.0

Note

In the first example, the chicken will be cooked for 3 minutes on the turned on stove, after this it will be cooked for <image>. Then the chicken will be cooked for one minute on a turned off stove, it will be cooked for <image>. Thus, after four minutes the chicken will be cooked for <image>. Before the fifth minute Julia will turn on the stove and after 2.5 minutes the chicken will be ready <image>.

In the second example, when the stove is turned off, Julia will immediately turn it on, so the stove will always be turned on and the chicken will be cooked in 20 minutes.

Solution (in JAVA):

Solution:
						import java.io.BufferedReader;
	import java.io.IOException;
	import java.io.InputStream;
	import java.io.InputStreamReader;
	import java.io.PrintWriter;
	import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
	import java.util.InputMismatchException;
								
									 
									public class Main implements Runnable
									{
										static final int MAX = 1000000007;
										static class InputReader
										{
											private InputStream stream;
											private byte[] buf = new byte[1024];
											private int curChar;
											private int numChars;
											private SpaceCharFilter filter;
											private BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
									
											public InputReader(InputStream stream)
											{
												this.stream = stream;
											}
											
											public int read()
											{
												if (numChars==-1) 
													throw new InputMismatchException();
												
												if (curChar >= numChars)
												{
													curChar = 0;
													try 
													{
														numChars = stream.read(buf);
													}
													catch (IOException e)
													{
														throw new InputMismatchException();
													}
													
													if(numChars <= 0)				
														return -1;
												}
												return buf[curChar++];
											}
										 
											public String nextLine()
											{
												String str = "";
									            try
									            {
									                str = br.readLine();
									            }
									            catch (IOException e)
									            {
									                e.printStackTrace();
									            }
									            return str;
											}
											public int nextInt()
											{
												int c = read();
												
												while(isSpaceChar(c)) 
													c = read();
												
												int sgn = 1;
												
												if (c == '-') 
												{
													sgn = -1;
													c = read();
												}
												
												int res = 0;
												do 
												{
													if(c<'0'||c>'9') 
														throw new InputMismatchException();
													res *= 10;
													res += c - '0';
													c = read();
												}
												while (!isSpaceChar(c)); 
												
												return res * sgn;
											}
											
											public long nextLong() 
											{
												int c = read();
												while (isSpaceChar(c))
													c = read();
												int sgn = 1;
												if (c == '-') 
												{
													sgn = -1;
													c = read();
												}
												long res = 0;
												
												do 
												{
													if (c < '0' || c > '9')
														throw new InputMismatchException();
													res *= 10;
													res += c - '0';
													c = read();
												}
												while (!isSpaceChar(c));
													return res * sgn;
											}
											
											public double nextDouble() 
											{
												int c = read();
												while (isSpaceChar(c))
													c = read();
												int sgn = 1;
												if (c == '-') 
												{
													sgn = -1;
													c = read();
												}
												double res = 0;
												while (!isSpaceChar(c) && c != '.') 
												{
													if (c == 'e' || c == 'E')
														return res * Math.pow(10, nextInt());
													if (c < '0' || c > '9')
														throw new InputMismatchException();
													res *= 10;
													res += c - '0';
													c = read();
												}
												if (c == '.') 
												{
													c = read();
													double m = 1;
													while (!isSpaceChar(c)) 
													{
														if (c == 'e' || c == 'E')
															return res * Math.pow(10, nextInt());
														if (c < '0' || c > '9')
															throw new InputMismatchException();
														m /= 10;
														res += (c - '0') * m;
														c = read();
													}
												}
												return res * sgn;
											}
											
											public String readString() 
											{
												int c = read();
												while (isSpaceChar(c))
													c = read();
												StringBuilder res = new StringBuilder();
												do 
												{
													res.appendCodePoint(c);
													c = read();
												} 
												while (!isSpaceChar(c));
												
												return res.toString();
											}
										 
											public boolean isSpaceChar(int c) 
											{
												if (filter != null)
													return filter.isSpaceChar(c);
												return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
											}
										 
											public String next() 
											{
												return readString();
											}
											
											public interface SpaceCharFilter 
											{
												public boolean isSpaceChar(int ch);
											}
										}
									 	
										public static void main(String args[]) throws Exception
										{
											new Thread(null, new Main(),"Main",1<<26).start();
										}
										long power(long x, long y)
										{
										    long res = 1;      // Initialize result
										 
										    x = x % MAX;  // Update x if it is more than or 
										                // equal to p
										 
										    while (y > 0)
										    {
										        // If y is odd, multiply x with result
										        if (y % 2 == 1)
										            res = (res*x) % MAX;
										 
										        // y must be even now
										        y = y>>1; // y = y/2
										        x = (x*x) % MAX;  
										    }
										    return res;
										}
										
										public void run()
										{
											InputReader sc= new InputReader(System.in);
											PrintWriter w= new PrintWriter(System.out);
											long a = sc.nextLong();
											long b = sc.nextLong();
											long c = sc.nextLong();
											if(a > b){
												if(a % b == 0){
													double ans = bsearch(0,2*c,a,0,c);
													System.out.printf("%.9f",ans);
												}else{
													long tmp = b - (a % b);
													double ans = bsearch(0,2*c,a,tmp,c);
													System.out.printf("%.9f",ans);
												}
											}else{
												double ans = bsearch(0,2*c,a,(b-a),c);
												System.out.printf("%.9f",ans);
											}
											
											w.close();
										}
										double bsearch(double l,double r,double a,double b,double t){
											
											while(true){
												if(Math.abs(l-r) < 0.000000000000001){
													break;
												}
												double mid = (l + r)/2;
												
												int x = fun(mid,a,b,t);
												if(x == 0){
													return mid;
												}else if(x == 1){
													r = mid - 0.000000000000001;
												}else{
													l = mid + 0.000000000000001;
												}
											}
											return -1;
										}
										int fun(double mid,double a,double b,double t){
											double modu = (mid % (a + b));
											double aw = (((long)(mid/(a+b)) * a) + Math.min(modu,a))/t;
											double aw2 = (((long)(mid/(a+b)) * b) + (modu - a > 0 ? modu-a : 0))/(2.0*t);
											if(Math.abs(aw + aw2 - 1) <= 0.00000000001){
												return 0;
											}else if(aw + aw2 > 1){
												return 1;
											}else{
												return -1;
											}
										}
										boolean isPrime(int n)
										{
										    // Corner cases
										    if (n <= 1)  return false;
										    if (n <= 3)  return true;
										 
										    // This is checked so that we can skip 
										    // middle five numbers in below loop
										    if (n%2 == 0 || n%3 == 0) return false;
										 
										    for (int i=5; i*i<=n; i=i+6)
										        if (n%i == 0 || n%(i+2) == 0)
										           return false;
										 
										    return true;
										}
										ArrayList<Integer> sieveOfEratosthenes(int n,int m)
									    {
									        // Create a boolean array "prime[0..n]" and initialize
									        // all entries it as true. A value in prime[i] will
									        // finally be false if i is Not a prime, else true.
									        boolean prime[] = new boolean[n+1];
									        for(int i=0;i<n;i++)
									            prime[i] = true;
									         
									        for(int p = 2; p*p <=n; p++)
									        {
									            // If prime[p] is not changed, then it is a prime
									            if(prime[p] == true)
									            {
									                // Update all multiples of p
									                for(int i = p*2; i <= n; i += p)
									                    prime[i] = false;
									            }
									        }
									        ArrayList<Integer> ar=  new ArrayList();
									        // Print all prime numbers
									        for(int i = 2; i <= n; i++)
									        {
									            if(prime[i] == true && i > m)
									               ar.add(i);
									        }
									        return ar;
									    }
										public long gcd(long a,long b)
									    {
									        if (a == 0)
									            return b;
									        
									        return gcd(b%a, a);
									    }
									    // method to return LCM of two numbers
									     long lcm(long a, long b)
									    {
									        return (a*b)/gcd(a, b);
									    }
										static class Node implements Comparable<Node>{
											long a;
											long b;
											Node(long destination,long weight){
												this.a = destination;
												this.b = weight;
											}
											Node(){
												
											}
											@Override
											public int compareTo(Node n){
												return Long.compare(a,n.a);
											}
										}
										static class Pair implements Comparable<Pair>{
											int a;
											int b;
											int c;
											Pair(int a,int b,int c){
												this.a = a;
												this.b = b;
												this.c = c;
											}
											public boolean equals(Object o)
											{
												Pair p = (Pair)o;
												return (p.a==this.a && p.b== this.b) || (p.a == this.b && p.b == this.a);
											}
											public int compareTo(Pair p){
												return Long.compare(this.a,p.a);
											}
											public int hashCode()
											{
												return new Long(a).hashCode()*31 + new Long(b).hashCode();
											}
										}
									}