#include<cstdio>
#define eps 1e-10
double k,d,t;
int main(){
//  freopen("c.in","r",stdin);
    scanf("%lf%lf%lf",&k,&d,&t);
    double ti=(long long)((k-1)/d)+1;double p=ti*d;
    double ans=0;double tim=(long long)(2*t/(p+k));
    ans+=tim*p;double rest=2*t-(p+k)*tim;
    if (rest<2*k) ans+=rest/2;else ans+=k,ans+=rest-2*k;
    printf("%.10f",ans);
    return 0;
}


#include <iostream>
using namespace std;
int main()
{
	long long a, b;
	double all;
	scanf("%lld%lld%lf", &a, &b, &all);
	double Ttime = 0, Ts = 0;
	double alltime;
	while (Ttime < a)
		Ttime += b;
	Ts = a + (Ttime - a) / 2;
	alltime = (int)(all / Ts) * Ttime;
	all -= (int)(all / Ts) * Ts;
	if (all <= a)
		alltime += all;
	else
	{
		alltime += a;
		all -= a;
		alltime += all * 2;
	}
	printf("%.1lf\n", alltime);
}


//                                                                                ..XQZKSUI25IK:
//                                                                                .iiPK5uU122L..
//                                .                                                                                :jEKIIU5XDPj:
//                              .::.                                                                                :XPESSI55qPL
//                             iJ77vvrr                                                                                :7PPXIIIXqgjr
//                            :rrrr7r7r.                                                                                iudPKq5SSPE7:
//                           .srrirri..                                         ...:i:iv7:i:i:i:...                             UUKSbXSIXqZbD7.
//                           .7riri7i..                                ..i7LqZQBBBBBBBBBBBQBBBQBBBQBZKUs::.                        .JKPX25IKKEP.
//                         .:.7rrir7i                             :72IgBBBBBBQBBBQBBBQBBBBBBBBBBBBBBBBBBBQQSvr7:.                    :IUSUI1IIqdd
//                         ...rrirrvi .                        .rEBBBBBBQBBBBBBBBBBBBBBBQBBBBBBBBBBBBBBBBBBBBBBBEr.                    i21u2U2UXqMv.
//                         :rrrirrr:.                       .vSQBBBBBBBBBBBBBBBBBBBBBQBBBBBBBBBBBBBBBQBQBBBBBQBBBQBIv.                vUdYJ152IUSX5X:
//                         :vrirrri..                    Y2MBBBBBBBBBBBBBBQBQg5qqXv777777777777J2PMQBBBBQBBBBBBBBBBBBB5ri            rQBQBBqKPXX25SdqI.
//                        .:7rrirr7                   r2ZBBQBBBBBBBBBBBKur:..                     ...:Y1PZBBBBBBBQBBBBBBBEY.       .IZBBBBB.:udbPSSIqbXP.
//                       .v7rrirr7v                 uEBBBBBBBBBBQE1vi..                                  ..JdBBBBBBBBBQBBBBB1i   .vsBBQBBgU    :iZqXSPgB:
//                       .vrrrriri:             . 2dBBBBBBBQBBMYi                                            ..7EQBQBBBBBBBBBBL: :ZbBBBMX:.      :Sdbd7i.
//                       .7ririr7.              YvQBQBBBBBBBgsi.                                     .          :LuQBBBBBBBBBBMPrsPZBBBX:         :7rr
//                       .7rrrrrs.            7JBQBBBBBBBXIi                                                       .vQBBBBBQBBBBBBQQBZ7.
//                      :rrrirrrr.          :jBBQBBBBBQ5r                       ::.      ..                          .rXPBBBBBBBBBBBQ7
//                      L7rirr7:.         .vgBBBBBBBdY.                      .rrgK.    .rKqi:.                           2QBBBBBBBBBBu
//                      r7irir7:.        .rBBBBBQBbU                        rJMgK1   .:irYLYUQJ.                          .7QBBBBBQBBBP7
//                    ::7rrrrrv:        :qQBBQBBKK       ...        . .:7Jr7dIuj17   i7i.   .rv7:.                          rPBBBBBBBQBQb.
//                    .:rrirr77:       .rBBBBBBB..                   .iZBBRMBQZdri   iii:i:i.  iir                            qBBBBBBBBBB:
//                    77rrrrri:        sdBBBBBXs                    v5BBBBBBBQMZ7i    .2PSqgQQQ5i.                            :vBBBBBBBBBd5
//                    r7irirr.       riBBBBBBZ.                    .iLi::r77:iirii     ..:..:rUgr.                             .ugBBQBQBBBB:i
//                  ..rrririi:.     .ZqBBBBQj:                                .....         .                                    iBDBBBBBBBSd:
//                  :Lrrir:7v1QK7. .iBMBBBQu.                                ...     .                                            :rBBBBBBBBBL.
//                  :vriri:IQRBBBPJisBBBBBP:.                             ..7.          .                                           gQBBBBBQBdU
//                 .:7irii.QBBBBBBQEZBBBBE7                               ..:r77r:    . ....                                        rPBBBBQBBBB.
//                 .:rririiKQQBBBBBBBBBBBr:                            ...   .LLQEvvsrr.. ...                                        iBBBBBBBBBri
//                .iirirrri. .iYUQBBBBBBgi.                           .i..      :ir77:.    ....                                      .UgQBBBBBBd1
//              . :Yvrrrv:       :1QBBBBb..                         . .:LJ77jsJv:....       ....                                      .IBBBBBBBBB.
//                .7r77vr:        .PQBBBX                           ..  LMQg7v7vri.......i::....                                       7RBBBBBBBBv:
//                 .:rii.          vdBBE1                           .   .7UY....:...... rDRr.                                          .igBQBBBBBXr
//                  .r..           7KBBgu                                 vKBBBBBBqPPjvr7KK. .                                           bBBBBBBBQr
//                                 7bBBg1                                  .BBZZMDMggBBbr    ..                                          IgBBBBBBgv
//                                 .rBQDI:.                                 .        i:    ..                                            .:BQBBBQIi
//                                  .5uQB57                                 . ...                                                          ::v2ri
//                                  .i:bgPv                                 ........
//                                     iUD1
//                                     ..r:.
//
//
//                                             RB.  BQ1X:            rs                                       BR  :BBsK.            r7
//                                          2DSRBQvBM.ij:     BRJBB  BBr        EBi                        qdKgBPjBD:rJ:    :QPKBB  BB:        BB.
//                                            R1L 7B7gB       Bj:B   BB         gBd                          QJs 7BiMB       B7rB   BB         BB.
//                                           2B7BK.SMQ7       Q:iE   B5         vBi                         5BIBP.PPgi       B.I1   Qs         BQ
//                                          ZBKBg iiXQi       BrBB7 rBB         UB                         BBKBU.:vLP:       BKRB  rBu         LB
//                                          .BQi.YEQr2QBBdY   Q. r  QZPB        SB                         .BB:.LZg:XBBBXu   B. i  BLBB        7B
//                                        idBi EIBB:Y. .jUI   B.  .BR  QBr      rB                       iBB::QJBBi7: :s5I.  Bi  :BD  BBr      :B
//                                        :: .Bi QB JBi       Q..dQi    BBQBv   JB:                      :. .Bi SB ZQi      .Bi.QBr    BQBBs   QB:
//                                           PQ 1BB  QB       B...        .r:   KBr                         qd vBB  BB       Q...        :r:   gB:
//
#include <iostream>
using namespace std;
int main()
{
	long long a, b, n;
	scanf("%lld%lld%lld", &a, &b, &n);
	long long T = b;
	while (T < a)
		T += b;
	//T是周期
	double s = a + (T - a) / 2.0;
	//S是周期完成量
	double sum = (int)(n / T) * s;
	double ans = (int)(n / T) * T;
	if (n - sum != 0)
	{
		if (n - sum <= a)
			ans += n - sum;
		else
			ans += n - a + (n - sum - a) * 2;
	}
	printf("%.1lf\n", ans);
}


#include <iostream>
using namespace std;
int main()
{
	int a, b;
	double all;
	scanf("%d%d%lf", &a, &b, &all);
	double Ttime = 0, Ts = 0;
	double alltime;
	while (Ttime < a)
		Ttime += b;
	Ts = a + (Ttime - a) / 2;
	alltime = (int)(all / Ts) * Ttime;
	all -= (int)(all / Ts) * Ts;
	if (all < a)
		alltime += all;
	else
	{
		alltime += a;
		all -= a;
		alltime += all * 2;
	}
	printf("%.1lf\n", alltime);
}


#include <bits/stdc++.h>

using namespace std;

#define topper top //XDDDDDDD

#define mp make_pair
#define pb push_back
#define db(x) cerr << #x << " == " <<  x << endl;
#define _ << " " <<

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> ii;

const long double EPS = 1e-9;
const int N=1e5+5;
const int MOD=1e9+7;
const int INF=0x3f3f3f3f;

ll k, d, t;

int main(){
  scanf("%lld %lld %lld", &k, &d, &t);

  if(k % d == 0) {
    printf("%lld\n", t);
    return 0;
  }
  if(k <= d) {
    ll walk = ((d - k)*1 + (k)*2);
    ll cycles = (2*t) / walk;
    ll timepassed = cycles*d;

    ll r = (2*t) % (walk);

    bool half;
    if(r <= k*2) {
      timepassed += r / 2;
      half = r&1;
    }
    else {
      timepassed += k + (r - 2*k);
      half = false;
    }

    printf("%lld%s\n", timepassed, half ? ".5" : "");
  }
  else {
    ll big = ((k/d)+1)*d;
    ll walk = (big - k)*1 + (k)*2;
    ll cycles = (2*t) / walk;
    ll timepassed = cycles * big;

    ll r = (2*t) % walk;
    bool half;
    if(r <= big*2) {
      timepassed += r / 2;
      half = r&1;
    }
    else {
      timepassed += big + (r - 2*big);
      half = false;
    }

    printf("%lld%s\n", timepassed, half ? ".5" : "");
  }

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define topper top //XDDDDDDD

#define mp make_pair
#define pb push_back
#define db(x) cerr << #x << " == " <<  x << endl;
#define _ << " " <<

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> ii;

const long double EPS = 1e-9;
const int N=1e5+5;
const int MOD=1e9+7;
const int INF=0x3f3f3f3f;

ll k, d, t;

int main(){
  scanf("%lld %lld %lld", &k, &d, &t);

  if(k % d == 0) {
    printf("%.12Lf\n", (ld)t);
    return 0;
  }
  if(k <= d) {
    ll walk = ((d - k)*1 + (k)*2);
    ll cycles = (2*t) / walk;
    ld timepassed = cycles*d;

    ll r = (2*t) % (walk);

    if(r <= k*2) {
      timepassed += (ld)r / 2;
    }
    else {
      timepassed += k + (ld)(r - 2*k);
    }

    printf("%.12Lf\n", timepassed);
  }
  else {
    ll big = ((k/d)+1)*d;
    ll walk = (big - k)*1 + (k)*2;
    ll cycles = (2*t) / walk;
    ld timepassed = cycles * big;

    ll r = (2*t) % walk;
    if(r <= big*2) {
      timepassed += (ld)r / 2;
    }
    else {
      timepassed += big + (ld)(r - 2*big);
    }

    printf("%.12Lf\n", timepassed);
  }

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define topper top //XDDDDDDD

#define mp make_pair
#define pb push_back
#define db(x) cerr << #x << " == " <<  x << endl;
#define _ << " " <<

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> ii;

const long double EPS = 1e-9;
const int N=1e5+5;
const int MOD=1e9+7;
const int INF=0x3f3f3f3f;

ll k, d, t;

int main(){
  scanf("%lld %lld %lld", &k, &d, &t);

  if(k % d == 0) {
    printf("%lld\n", t);
    return 0;
  }
  if(k <= d) {
    ll walk = ((d - k)*1 + (k)*2);
    ll cycles = (2*t) / walk;
    ll timepassed = cycles*d;

    ll r = (2*t) % (walk);

    bool half;
    if(r <= k*2) {
      timepassed += r / 2;
      half = true;
    }
    else {
      timepassed += k + (r - 2*k);
      half = false;
    }

    if(!r) half = false;
    printf("%lld%s\n", timepassed, half ? ".5" : "");
  }
  else {
    ll big = ((k/d)+1)*d;
    ll walk = (big - k)*1 + (k)*2;
    ll cycles = (2*t) / walk;
    ll timepassed = cycles * big;

    ll r = (2*t) % walk;
    bool half;
    if(r <= big*2) {
      timepassed += r / 2;
      half = true;
    }
    else {
      timepassed += big + (r - 2*big);
      half = false;
    }

    if(!r) half = false;
    printf("%lld%s\n", timepassed, half ? ".5" : "");
  }

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define topper top //XDDDDDDD

#define mp make_pair
#define pb push_back
#define db(x) cerr << #x << " == " <<  x << endl;
#define _ << " " <<

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> ii;

const long double EPS = 1e-9;
const int N=1e5+5;
const int MOD=1e9+7;
const int INF=0x3f3f3f3f;

ll k, d, t;

int main(){
  scanf("%lld %lld %lld", &k, &d, &t);

  if(k % d == 0) {
    printf("%.12Lf\n", (ld)t);
    return 0;
  }
  if(k <= d) {
    ll walk = ((d - k)*1 + (k)*2);
    ll cycles = (2*t) / walk;
    ld timepassed = cycles*d;

    ll r = (2*t) % (walk);

    if(r <= k*2) {
      timepassed += (ld)r / 2;
    }
    else {
      timepassed += k + (ld)(r - k) / 2;
    }

    printf("%.12Lf\n", timepassed);
  }
  else {
    ll big = ((k/d)+1)*d;
    ll walk = (big - k)*1 + (k)*2;
    ll cycles = (2*t) / walk;
    ld timepassed = cycles * big;

    ll r = (2*t) % walk;
    if(r <= big*2) {
      timepassed += (ld)r / 2;
    }
    else {
      timepassed += big + (ld)(r - big)/2;
    }

    printf("%.12Lf\n", timepassed);
  }

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define topper top //XDDDDDDD

#define mp make_pair
#define pb push_back
#define db(x) cerr << #x << " == " <<  x << endl;
#define _ << " " <<

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> ii;

const long double EPS = 1e-9;
const int N=1e5+5;
const int MOD=1e9+7;
const int INF=0x3f3f3f3f;

ll k, d, t;

int main(){
  scanf("%lld %lld %lld", &k, &d, &t);

  if(k % d == 0) {
    printf("%lld\n", t);
    return 0;
  }
  if(k <= d) {
    ll walk = ((d - k)*1 + (k)*2);
    ll cycles = (2*t) / walk;
    ll timepassed = cycles*d;

    ll r = (2*t) % (walk);

    bool half;
    if(r <= k*2) {
      timepassed += (ld)r / 2;
      half = true;
    }
    else {
      timepassed += k + (r - 2*k);
      half = false;
    }

    printf("%lld%s\n", timepassed, half ? ".5" : "");
  }
  else {
    ll big = ((k/d)+1)*d;
    ll walk = (big - k)*1 + (k)*2;
    ll cycles = (2*t) / walk;
    ll timepassed = cycles * big;

    ll r = (2*t) % walk;
    bool half;
    if(r <= big*2) {
      timepassed += r / 2;
      half = true;
    }
    else {
      timepassed += big + (r - 2*big);
      half = false;
    }

    printf("%lld%s\n", timepassed, half ? ".5" : "");
  }

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define topper top //XDDDDDDD

#define mp make_pair
#define pb push_back
#define db(x) cerr << #x << " == " <<  x << endl;
#define _ << " " <<

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> ii;

const long double EPS = 1e-9;
const int N=1e5+5;
const int MOD=1e9+7;
const int INF=0x3f3f3f3f;

ll k, d, t;

int main(){
  scanf("%lld %lld %lld", &k, &d, &t);

  if(k % d == 0) {
    printf("%lld\n", t);
    return 0;
  }
  if(k <= d) {
    ll walk = ((d - k)*1 + (k)*2);
    ll cycles = (2*t) / walk;
    ll timepassed = cycles*d;

    ll r = (2*t) % (walk);

    bool half;
    if(r <= k*2) {
      timepassed += r / 2;
      half = r&1;
    }
    else {
      timepassed += k + (r - 2*k);
      half = false;
    }

    printf("%lld%s\n", timepassed, half ? ".5" : "");
  }
  else {
    ll big = ((k/d)+1)*d;
    ll walk = (big - k)*1 + (k)*2;
    ll cycles = (2*t) / walk;
    ll timepassed = cycles * big;

    ll r = (2*t) % walk;
    bool half;
    if(r <= k*2) {
      timepassed += r / 2;
      half = r&1;
    }
    else {
      timepassed += k + (r - 2*k);
      half = false;
    }

    printf("%lld%s\n", timepassed, half ? ".5" : "");
  }

	return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define ull unsigned long long
#define db long double
#define pb push_back
#define ppb pop_back
#define F first
#define S second
#define mp make_pair
#define all(x) (x).begin(), (x).end()

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <int> vi;
typedef vector <ll> vll;

typedef tree <pii, null_type, less <pii>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

ll k, d, t;

int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif

	cin >> k >> d >> t;
	k *= 2;
	d *= 2;
	t *= 2;
	if (k % d == 0) {
		cout << t / 2;
		return 0;
	}
	ll m = d * (k / d + 1);
	ll c = k + (m - k) / 2;
	ll can = t / c;
	ll ans = can * m;
	t %= c;
	if (t > k) {
		t -= k;
		cout << setprecision(30) << (ans + k + 2 * t) / 2;
	}	else {
		cout << setprecision(30) << (db)(ans + t) / 2;
	}
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define ull unsigned long long
#define db long double
#define pb push_back
#define ppb pop_back
#define F first
#define S second
#define mp make_pair
#define all(x) (x).begin(), (x).end()

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <int> vi;
typedef vector <ll> vll;

typedef tree <pii, null_type, less <pii>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

ll k, d, t;

int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif

	cin >> k >> d >> t;
	k *= 2;
	d *= 2;
	t *= 2;
	if (k % d == 0) {
		cout << t / 2;
		return 0;
	}
	ll m = d * (k / d + 1);
	ll c = k + (m - k) / 2;
	ll can = t / c;
	ll ans = can * m;
	t %= c;
	if (t > k) {
		t -= k;
		cout << setprecision(30) << (ans + k + (db)t / 2) / 2;
	}	else {
		cout << setprecision(30) << (db)(ans + t) / 2;
	}
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define ull unsigned long long
#define db long double
#define pb push_back
#define ppb pop_back
#define F first
#define S second
#define mp make_pair
#define all(x) (x).begin(), (x).end()

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <int> vi;
typedef vector <ll> vll;

typedef tree <pii, null_type, less <pii>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

ll k, d, t;

int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif

	cin >> k >> d >> t;
	k *= 2;
	d *= 2;
	t *= 2;
	if (k % d == 0) {
		cout << t / 2;
		return 0;
	}
	ll m = d * (k / d + 1);
	ll c = k + (m - k) / 2;
	ll can = t / c;
	ll ans = can * m;
	t %= c;
	if (t > k) {
		t -= k;
		cout << setprecision(25) << (db)(ans + k + t / 2) / 2;
	}	else {
		cout << setprecision(25) << (db)(ans + t) / 2;
	}
}


#include <iostream>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <string>
#include <cstdlib>
#include <list>
#include <climits>
#include <queue>
#include <cmath>
#include <deque>
#include <set>
#include <iomanip>
using namespace std;

void dfs(vector <vector <int>> & g, vector <int> & c, int id, int & t)
{
	c[id] = 1;
	for (int i = 0; i < g[id].size(); ++i)
	{
		if (g[id][i] == 0)
				continue;
		if (c[i] == 1) t = 0;
		if (!c[i])
			dfs(g, c, i, t);

	}
	c[id] = 2;

}

int main()
{
	long long int k, d, t, a, b;
	a = 2;
	b = 1;
	long double konez;
	cin >> k >> d >> t;
	long long int S = a*t;
	long long int T = 0;
	if (d >= k)
	{
		T += (S/(a*k + b*(d - k)));
		S = S%(a*k + b*(d - k));
		T *= d;
		if (S > 2*k)
		{
			long long int y, u;
			y = (S - 2*k)/b;
			u = (S - 2*k)%b;
			long double e = u;
			long double f = b;
			e = e/f;
			T+=  k;
			T+= y;
			 konez = T;
			konez+=e;
		}
		else
		{
			long long int y, u;
			y = S/a;
			u = S%a;
			long double e = u;
			long double f = a;
			e = e/f;
			T+= y;
			 konez = T;
			konez+=e;
		}
	}
	if (d < k)
	{
		long long int x = k/d;
		if (x*d < k) x++;

		T +=  (S/(a*k + b*(d*x - k)));
		T*= d*x;
		S = S%(a*k + b*(d*x - k));
		if (S > 2*k)
		{
			long long int y, u;
			y = (S - 2*k)/b;
			u = (S - 2*k)%b;
			long double e = u;
			long double f = b;
			e = e/f;
			T+=  k;
			T+= y;
			 konez = T;
			konez+=e;
		}
		else
		{
			long long int y, u;
			y = S/a;
			u = S%a;
			long double e = u;
			long double f = a;
			e = e/f;
			T+= y;
			 konez = T;
			konez+=e;
		}
	}

	if (t >= 100000000)
		cout << T;
	else
		cout << konez;
}


#include <iostream>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <string>
#include <cstdlib>
#include <list>
#include <climits>
#include <queue>
#include <cmath>
#include <deque>
#include <set>
#include <iomanip>
using namespace std;

void dfs(vector <vector <int>> & g, vector <int> & c, int id, int & t)
{
	c[id] = 1;
	for (int i = 0; i < g[id].size(); ++i)
	{
		if (g[id][i] == 0)
				continue;
		if (c[i] == 1) t = 0;
		if (!c[i])
			dfs(g, c, i, t);

	}
	c[id] = 2;

}

int main()
{
	long long int k, d, t, a, b;
	a = 2;
	b = 1;
	long double konez;
	cin >> k >> d >> t;
	long long int S = a*t;
	long long int T = 0;
	if (d >= k)
	{
		T += (S/(a*k + b*(d - k)));
		S = S%(a*k + b*(d - k));
		T *= d;
		if (S > 2*k)
		{
			long long int y, u;
			y = (S - 2*k)/b;
			u = (S - 2*k)%b;
			long double e = u;
			long double f = b;
			e = e/f;
			T+=  k;
			T+= y;
			 konez = T;
			konez+=e;
		}
		else
		{
			long long int y, u;
			y = S/a;
			u = S%a;
			long double e = u;
			long double f = a;
			e = e/f;
			T+= y;
			 konez = T;
			konez+=e;
		}
	}
	if (d < k)
	{
		long long int x = k/d;
		if (x*d < k) x++;

		T +=  (S/(a*k + b*(d*x - k)));
		T*= d*x;
		S = S%(a*k + b*(d*x - k));
		if (S > 2*k)
		{
			long long int y, u;
			y = (S - 2*k)/b;
			u = (S - 2*k)%b;
			long double e = u;
			long double f = b;
			e = e/f;
			T+=  k;
			T+= y;
			 konez = T;
			konez+=e;
		}
		else
		{
			long long int y, u;
			y = S/a;
			u = S%a;
			long double e = u;
			long double f = a;
			e = e/f;
			T+= y;
			 konez = T;
			konez+=e;
		}
	}

	if (t >= 1000000000)
		cout << T;
	else
		cout << konez;
}


#include <iostream>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <string>
#include <cstdlib>
#include <list>
#include <climits>
#include <queue>
#include <cmath>
#include <deque>
#include <set>
#include <iomanip>
using namespace std;

void dfs(vector <vector <int>> & g, vector <int> & c, int id, int & t)
{
	c[id] = 1;
	for (int i = 0; i < g[id].size(); ++i)
	{
		if (g[id][i] == 0)
				continue;
		if (c[i] == 1) t = 0;
		if (!c[i])
			dfs(g, c, i, t);

	}
	c[id] = 2;

}

int main()
{
	long long int k, d, t, a, b;
	a = 2;
	b = 1;
	long double konez;
	cin >> k >> d >> t;
	long long int S = a*t;
	long long int T = 0;
	if (d >= k)
	{
		T += (S/(a*k + b*(d - k)));
		S = S%(a*k + b*(d - k));
		T *= d;
		if (S > 2*k)
		{
			long double e = (S - 2*k);
			long double f = b;
			e = e/f;
			T+=  k;
			 konez = T;
			konez+=e;
		}
		else
		{
			long double e = S;
			long double f = a;
			e = e/f;
			 konez = T;
			konez+=e;
		}
	}
	if (d < k)
	{
		long long int x = k/d;
		if (x*d < k) x++;

		T +=  (S/(a*k + b*(d*x - k)));
		T*= d*x;
		S = S%(a*k + b*(d*x - k));
		if (S > 2*k)
		{
			long double e = (S - 2*k);
			long double f = b;
			e = e/f;
			T+=  k;
			konez = T;
			konez+=e;
		}
		else
		{
			long double e = S;
			long double f = a;
			e = e/f;
			konez = T;
			konez+=e;
		}
	}

	cout << konez;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    long double t;
    ll k,d;
    cin>>k>>d>>t;
    if(k%d==0)d=k;
    if(d<k)d=k/d*d+d;
    ll buf=2*t/(k+d);
    long double ans=buf*d;
    t-=buf*0.5*(k+d);
    if(t>k)ans=ans+k+(t-k)*2;
    else ans+=t;
    printf("%.1lf\n",ans);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll k,d,t;
    cin>>k>>d>>t;
    if(k%d==0)d=k;
    if(d<k)d=k/d*d+d;
    ll sum = 2*t/(d+k)*(d+k),ans=2*t/(d+k)*d;
    if(sum+2*k<=2*t)
    {
        ans+=k;
        sum=2*t-2*k-sum;
    }
    else sum=2*t-sum;
    cout<<ans+sum/2;
    if(sum%2)cout<<".5";
    cout<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    long double t;
    ll k,d;
    cin>>k>>d>>t;
    if(k%d==0)d=k;
    if(d<k)d=k/d*d+d;
    ll buf=2*t/(k+d);
    double ans=buf*d;
    t-=buf*0.5*(k+d);
    if(t>k)ans=ans+k+(t-k)*2;
    else ans+=t;
    printf("%.1f\n",ans);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll k,d,t;
    cin>>k>>d>>t;
    if(k%d==0)d=k;
    if(d<k)d=k/d*d+d;
    ll sum = 2*t/(d+k)*(d+k),ans=2*t/(d+k)*d;
    if(sum+2*k<=2*t)
    {
        ans+=k;
        sum=2*t-2*k-sum;
        printf("%.9f\n",ans+sum/2+sum%2*0.5);
    }
    else
    {
        sum=2*t-sum;
        printf("%.9f\n",ans+sum/2+sum%2*0.5);
    }
    return 0;
}


/**
 * title : codeforces_940F
 * author : Anoxiacxy
 * date : 2018_2_25
 * tags : 莫队
 */
#include <bits/stdc++.h>
using namespace std;
#define debug cerr << "here is line " << __LINE__ << endl;
typedef long long ll;
typedef double db;
int main() {
    ll k, d, t; cin >> k >> d >> t;
    ll t1 = (k + d - 1) / d * d;
    //cout << t1 << endl;
    ll a = k * 2 + (t1 - k);
    //cout << a<< endl;
    db b = t * 2 / a;
    db ans = b * t1;
    ll c = t * 2 % a;
    if (c < k * 2) ans = ans + c * 0.5;
    else ans = ans + k + (c - k * 2);
    cout << ans << endl;
}


/**
 * title : codeforces_940F
 * author : Anoxiacxy
 * date : 2018_2_25
 * tags : 莫队
 */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
int main() {
    ll k, d, t; cin >> k >> d >> t;
    ll a = k / d + (k % d != 0 ? 1 : 0);
    ll b = a * d + k;
    t <<= 1;
    ll c = t / b;
    ll e = t % b;
    db ans = c * (a * d);
    if (e <= k * 2) ans += e * 0.5;
    else ans += k + (e - k * 2);
    printf("%.9lf", ans);
}


/**
 * title : codeforces_940F
 * author : Anoxiacxy
 * date : 2018_2_25
 * tags : 莫队
 */
#include <bits/stdc++.h>
using namespace std;
#define debug cerr << "here is line " << __LINE__ << endl;
typedef long long ll;
typedef double db;
int main() {
    ll k, d, t; cin >> k >> d >> t;
    ll t1 = (k + d - 1) / d * d;
    //cout << t1 << endl;
    ll a = (k << 1) + (t1 - k);
    //cout << a<< endl;
    ll b = (t << 1) / a;
    db ans = b * t1;
    ll c = (t << 1) % a;
    if (c < k << 1) ans = ans + c * 0.5;
    else ans = ans + k + (c - k) * 2;
    cout << ans << endl;
}


#include <bits/stdc++.h>
using namespace std;

#define err(x) cerr << #x << " - " << x << endl;

typedef long long llint;

int main() {
  llint k, d, t;
  cin >> k >> d >> t;

  double period = d;
  if (d < k) period *= k / d + (k % d > 0);

  double off = period - k;
  double cook = k + off / 2;

  double times = floor(t / cook);
  double cooked = cook * times;
  double time = period * times;

  if (cooked + k <= t)
    cooked += k, time += k;
  else if (cooked < t)
    time += t - cooked, cooked = t;

  time += 2 * (t - cooked);
  cout << time << endl;

  return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long llint;

int main() {
  llint k, d, t;
  cin >> k >> d >> t; t *= 2;

  llint period = d;
  if (d < k) period *= k / d + (k % d > 0);

  llint sol = t / (k + period) * period;
  t %= k + period;

  if (t >= 2*k) sol += t - k;
  else sol += t / 2;

  cout << sol;
  if (t & 1) cout << ".5";
  return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long llint;

int main() {
  llint k, d, t;
  cin >> k >> d >> t; t *= 2;

  llint period = d;
  if (d < k) period *= k / d + (k % d > 0);

  llint sol = t / (k + period) * period;
  t %= k + period;

  if (t >= 2*k) sol += t - k, t = 0;
  else sol += t / 2;

  cout << sol;
  if (t & 1) cout << ".5";
  return 0;
}


#include<bits/stdc++.h>
#define MAXN
using namespace std;

inline void read(long long &x){
    char ch;
    bool flag=false;
    for (ch=getchar();!isdigit(ch);ch=getchar())if (ch=='-') flag=true;
    for (x=0;isdigit(ch);x=x*10+ch-'0',ch=getchar());
    x=flag?-x:x;
}

inline void read(int &x){
    char ch;
    bool flag=false;
    for (ch=getchar();!isdigit(ch);ch=getchar())if (ch=='-') flag=true;
    for (x=0;isdigit(ch);x=x*10+ch-'0',ch=getchar());
    x=flag?-x:x;
}

inline void write(long long x){
    static const long long maxlen=100;
    static char s[maxlen];
    if (x<0) {   putchar('-'); x=-x;}
    if(!x){ putchar('0'); return; }
    long long len=0; for(;x;x/=10) s[len++]=x % 10+'0';
    for(long long i=len-1;i>=0;--i) putchar(s[i]);
}

long long d , k  , t;

int main(){
    read(k); read(d);   read(t);
    t=t*2;
    long long cost=2*k+( ( (k+d-1)/d )*d - k );
    long long len=(k+d-1)/d*d;
    long long T=t/cost;
    double ans=len*T;
    //cout<<ans<<" "<<T<<" " <<cost<<endl;
    if ( t-T*cost > 2*k )
        ans=ans+k+(t-T*cost)-2*k;
    else
        ans=ans+(t-T*cost)/2.0;
    printf("%.10f\n",ans);
    return 0;
}


#include<bits/stdc++.h>
#define MAXN
using namespace std;

inline void read(long long &x){
    char ch;
    bool flag=false;
    for (ch=getchar();!isdigit(ch);ch=getchar())if (ch=='-') flag=true;
    for (x=0;isdigit(ch);x=x*10+ch-'0',ch=getchar());
    x=flag?-x:x;
}

inline void read(int &x){
    char ch;
    bool flag=false;
    for (ch=getchar();!isdigit(ch);ch=getchar())if (ch=='-') flag=true;
    for (x=0;isdigit(ch);x=x*10+ch-'0',ch=getchar());
    x=flag?-x:x;
}

inline void write(long long x){
    static const long long maxlen=100;
    static char s[maxlen];
    if (x<0) {   putchar('-'); x=-x;}
    if(!x){ putchar('0'); return; }
    long long len=0; for(;x;x/=10) s[len++]=x % 10+'0';
    for(long long i=len-1;i>=0;--i) putchar(s[i]);
}

long long d , k  , t;
double  v1 , v2;

int main(){
    read(k); read(d);   read(t);
    v1=1.0/t;   v2=v1/2;
    long double cost=k*v1+( ( (k+d-1)/d )*d - k )*v2;
    int len=(k+d-1)/d*d;
    double T=1.0/cost;
    //printf("%.9f\n",T);
    double ans=len*(trunc(T));
    //cout<<ans<<"  "<<len<<" "<<cost<<endl;
    if ( 1-trunc(T)*cost > v1*k )
        ans=ans+k+( (1-trunc(T)*cost)-v1*k )/v2;
    else
        ans=ans+(1.0-trunc(T)*cost)/v1;
    printf("%.10f\n",ans);
    return 0;
}


#include<bits/stdc++.h>
#define MAXN
using namespace std;

inline void read(long long &x){
    char ch;
    bool flag=false;
    for (ch=getchar();!isdigit(ch);ch=getchar())if (ch=='-') flag=true;
    for (x=0;isdigit(ch);x=x*10+ch-'0',ch=getchar());
    x=flag?-x:x;
}

inline void read(int &x){
    char ch;
    bool flag=false;
    for (ch=getchar();!isdigit(ch);ch=getchar())if (ch=='-') flag=true;
    for (x=0;isdigit(ch);x=x*10+ch-'0',ch=getchar());
    x=flag?-x:x;
}

inline void write(long long x){
    static const long long maxlen=100;
    static char s[maxlen];
    if (x<0) {   putchar('-'); x=-x;}
    if(!x){ putchar('0'); return; }
    long long len=0; for(;x;x/=10) s[len++]=x % 10+'0';
    for(long long i=len-1;i>=0;--i) putchar(s[i]);
}

long long d , k  , t;
long double  v1 , v2;

int main(){
    read(k); read(d);   read(t);
    v1=1.0/t;   v2=v1/2;
    long double cost=k*v1+( ( (k+d-1)/d )*d - k )*v2;
    int len=(k+d-1)/d*d;
    long double T=1.0/cost;
    //printf("%.9f\n",T);
    long double ans=len*(trunc(T));
    //cout<<ans<<"  "<<len<<" "<<cost<<endl;
    if ( 1-trunc(T)*cost > v1*k )
        ans=ans+k+( (1-trunc(T)*cost)-v1*k )/v2;
    else
        ans=ans+(1.0-trunc(T)*cost)/v1;
    cout<<ans<<endl;
    return 0;
}


/**#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long LL;

double esp = 1e-15;

int main()
{
    LL k,d,t;
    double ans = 0;
    scanf("%I64d%I64d%I64d",&k,&d,&t);
    double needTime = 1;
    if(k%d == 0)
    {
        ans = t;
        printf("%.1f\n",ans);
    }
    else if(k > d)
    {
        LL off = d*((k/d)+1) - k;
        LL on = k;
        double T = (1.0*on)/t + (1.0*off)/(2*t);
        /*if(T-esp <= 0)
        {
            ans = esp / 1 * (on+off);
            printf("%.1f\n",ans);
        }*/
        //cout << T << endl;
        //printf("%I64d %I64d %lf\n",off,on,T);
        /*else
        {*/

 /*           LL i = needTime / T;

            // printf("ended\n");

            if(needTime-T*i-esp == 0)
            {
                ans = (on+off)*i;
            }
            else
            {
                needTime -= T*i;
                if(needTime-(1.0*on)/t-esp <= 0)
                {
                    ans = (on+off)*i + needTime*t;
                }
                else
                {
                    ans = (on+off)*i + on + (needTime-(1.0*on)/t)*2*t;
                }
            }
            printf("%.1f\n",ans);
       // }
    }
    else
    {
        LL off = d*((k/d)+1) - k;
        LL on = k;
        double T = (1.0*on)/t + (1.0*off)/(2*t);
        /*if(T-esp <= 0)
        {
            ans = esp / 1 * (on+off);
            printf("%.1f\n",ans);
        }*/
        //cout << T << endl;
        //printf("%I64d %I64d %lf\n",off,on,T);
        /*else
        {*/

/*            LL i = needTime / T;
            //cout << i << endl;

            // printf("ended\n");

            if(needTime-T*i-esp == 0)
            {
                //cout << "1" << endl;
                ans = (on+off)*i;
            }
            else
            {
                needTime -= T*i;
                if(needTime-(1.0*on)/t-esp <= 0)
                {
                    //cout << "2" << endl;
                    //cout << (on+off)*i << endl;
                    //cout << needTime*t << endl;
                    ans = (on+off)*i + needTime*t;
                }
                else
                {
                    cout << "3" << endl;
                    ans = (on+off)*i + on + (needTime-(1.0*on)/t)*2*t;
                }
            }
            printf("%.1f\n",ans);
       // }
    }
    return 0;
}*/

#include <iostream>
#include <cstdio>
using namespace std;

typedef long long LL;

int main()
{
    LL k,d,t;
    scanf("%I64d%I64d%I64d",&k,&d,&t);
    LL T = ((k-1) / d+1) * d;

    double ans = 0;
    double oneT = (T-k)*0.5 + k;
    ans += LL(t / oneT) * T;

    LL cnt = t/oneT;

    double left = t - cnt*oneT;
    if(left < k)
        ans += left;
    else
        ans = ans+k +(left-k)*2;
    printf("%.1f\n", ans);
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>

using namespace std;
typedef long long LL;

double esp = 1e-9;

int main()
{
    LL k,d,t;
    double ans = 0;
    scanf("%I64d%I64d%I64d",&k,&d,&t);
    double needTime = 1;
    if(k%d==0 || d%k==0)
    {
        ans = t;
        printf("%.1f\n",ans);
    }
    else if(k > d)
    {
        LL off = d*((k/d)+1) - k;
        LL on = k;
        double T = (1.0*on)/t + (1.0*off)/(2*t);

        // printf("%I64d %I64d %f\n",off,on,T);

        int i = 0;
        while(needTime-esp > 0)
        {
            i++;
            needTime -= T;
        }

        // printf("ended\n");

        if(needTime-esp == 0)
        {
            ans = (on+off)*i;
        }
        else
        {
            needTime += T;
            if(needTime-(1.0*on)/t-esp <= 0)
            {
                ans = (on+off)*(i-1) + needTime*t;
            }
            else
            {
                ans = (on+off)*(i-1) + on + (needTime-(1.0*on)/t)*2*t;
            }
        }
        printf("%.1f\n",ans);
    }
    else
    {
        LL off = d*((k/d)+1) - k;
        LL on = k;
        double T = (1.0*on)/t + (1.0*off)/(2*t);

        // printf("%I64d %I64d %f\n",off,on,T);

        int i = 0;
        while(needTime-esp > 0)
        {
            i++;
            needTime -= T;
        }

        // printf("ended\n");

        if(needTime-esp == 0)
        {
            ans = (on+off)*i;
        }
        else
        {
            needTime += T;
            if(needTime-(1.0*on)/t-esp <= 0)
            {
                ans = (on+off)*(i-1) + needTime*t;
            }
            else
            {
                ans = (on+off)*(i-1) + on + (needTime-(1.0*on)/t)*2*t;
            }
        }
        printf("%.1f\n",ans);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>

using namespace std;
typedef long long LL;

double esp = 1e-15;

int main()
{
    LL k,d,t;
    double ans = 0;
    scanf("%I64d%I64d%I64d",&k,&d,&t);
    double needTime = 1;
    if(k%d == 0)
    {
        ans = t;
        printf("%.1f\n",ans);
    }
    else if(k > d)
    {
        LL off = d*((k/d)+1) - k;
        LL on = k;
        double T = (1.0*on)/t + (1.0*off)/(2*t);
        /*if(T-esp <= 0)
        {
            ans = esp / 1 * (on+off);
            printf("%.1f\n",ans);
        }*/
        //cout << T << endl;
        //printf("%I64d %I64d %lf\n",off,on,T);
        /*else
        {*/

            LL i = needTime / T;

            // printf("ended\n");

            if(needTime-T*i-esp == 0)
            {
                ans = (on+off)*i;
            }
            else
            {
                needTime -= T*i;
                if(needTime-(1.0*on)/t-esp <= 0)
                {
                    ans = (on+off)*i + needTime*t;
                }
                else
                {
                    ans = (on+off)*i + on + (needTime-(1.0*on)/t)*2*t;
                }
            }
            printf("%.1f\n",ans);
       // }
    }
    else
    {
        LL off = d*((k/d)+1) - k;
        LL on = k;
        double T = (1.0*on)/t + (1.0*off)/(2*t);
        /*if(T-esp <= 0)
        {
            ans = esp / 1 * (on+off);
            printf("%.1f\n",ans);
        }*/
        //cout << T << endl;
        //printf("%I64d %I64d %lf\n",off,on,T);
        /*else
        {*/

            LL i = needTime / T;
            //cout << i << endl;

            // printf("ended\n");

            if(needTime-T*i-esp == 0)
            {
                //cout << "1" << endl;
                ans = (on+off)*i;
            }
            else
            {
                needTime -= T*i;
                if(needTime-(1.0*on)/t-esp <= 0)
                {
                    //cout << "2" << endl;
                    //cout << (on+off)*i << endl;
                    //cout << needTime*t << endl;
                    ans = (on+off)*i + needTime*t;
                }
                else
                {
                    cout << "3" << endl;
                    ans = (on+off)*i + on + (needTime-(1.0*on)/t)*2*t;
                }
            }
            printf("%.1f\n",ans);
       // }
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main(){
	long long k, d, t, per, rem, cir, h;
	int flag = 0;
	scanf("%I64d %I64d %I64d",&k,&d,&t);
	if (k < d){
		per = k + d;
		h = t * 2 / per * d;
		rem = t * 2 % per;
		if (rem <= k * 2){
			h += rem / 2;
			if (rem & 1LL) flag = 1;
		}
		else h += rem - k;
	}
	else{
		cir = ((k - 1) / d + 1) * d;
		per = k + cir;
		h = t * 2 / per * cir;
		rem = t * 2 % per;
		if (rem <= k * 2){
			h += rem / 2;
			if (rem & 1LL) flag = 1;
		}
		else h += rem - k;
	}
	printf("%I64d",h);
	if (flag) printf(".50000000000\n");
	else printf(".00000000000\n");
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main(){
	long long k, d, t, per, rem, cir;
	double h;
	scanf("%I64d %I64d %I64d",&k,&d,&t);
	if (k < d){
		per = k * 2 + (d - k);
		h = 1.0 * (t * 2 / per) * d;
		rem = t * 2 % per;
		if (rem <= k * 2) h += rem / 2.0;
		else h += 1.0 * (rem - k * 2);
	}
	else{
		cir = ((k - 1) / d + 1) * d;
		per = k * 2 + (cir - k);
		h = 1.0 * (t * 2 / per) * cir;
		rem = t * 2 % per;
		if (rem <= k * 2) h += rem / 2.0;
		else h += 1.0 * (rem - k * 2);
	}
	printf("%.10f\n",h);
	return 0;
}


#include<iostream>
#include<cstdio>
using namespace std;
typedef long long ll;
int main() {
    ll k, d, t, once, num;
    cin >> k >> d >> t;
    double onceMake, ans = 0, left;
    once = ((k-1)/d+1)*d; // ��k����ȡ����������ڳ���
    onceMake = (once-k)*0.5 + k; // һ����������ɵ�ʱ��
    num = t/onceMake; // �����Ҫ�������ڣ� ����ȡ��
    ans += num*once; // �����Ҫ���������� ����
    left =  t - num * onceMake; // �������ʱ�� = ��Ҫ����ʱ�� - ����ȡ���������� * ���ڳ���
    if(left < k) { // ���ʣ�����С��һ�ο�������ɵ���
        ans += left;// ֱ�ӿ������ʣ�µ���
    }
    else {
        ans += k + (left - k) * 2; // �ȼ��Ͽ�������������ɵ������ټ��� (ʣ�µ��� - k) * 2
    }
    printf("%.1lf", ans);
}


#include<iostream>
#include<cstdio>
using namespace std;
typedef long long ll;
int main() {
    ll k, d, t, once, num;
    cin >> k >> d >> t;
    double onceMake, ans = 0, left;
    once = ((k+1)/d)*d; // ��k����ȡ����������ڳ���
    onceMake = (once-k)*0.5 + k; // һ����������ɵ�ʱ��
    num = t/onceMake; // �����Ҫ�������ڣ� ����ȡ��
    ans += num*once; // �����Ҫ���������� ����
    left =  t - num * onceMake; // �������ʱ�� = ��Ҫ����ʱ�� - ����ȡ���������� * ���ڳ���
    if(left < k) { // ���ʣ�����С��һ�ο�������ɵ���
        ans += left;// ֱ�ӿ������ʣ�µ���
    }
    else {
        ans += k + (left - k) * 2; // �ȼ��Ͽ�������������ɵ������ټ��� (ʣ�µ��� - k) * 2
    }
    printf("%.1lf", ans);
}


#include <bits/stdc++.h>
#define rep(i,l,r) for(int i=int(l);i<int(r);i++)
#define put(x) cout<<#x<<" = "<<x<<endl;
#define X first
#define Y second
#define pb push_back
#define pp pop_back
#define int num
using namespace std;
typedef long long num;
typedef long double lod;
typedef pair<int,int> point;

int k,t,d,c;
lod ans;
int32_t main(){
    cin>>k>>d>>t;
    t*=2;
    put(d);
    d=((k+d-1)/d)*d;
    c=t/(d+k);
    ans=d*c;
    t-=(t/(d+k))*(d+k);
    put(t);
    put(c);
    if(2*k>=t){
	ans+=t/lod(2);
    }else{
	t-=2*k;
	ans+=k+t;
    }
    cout<<setprecision(20)<<fixed;
    cout<<ans<<endl;
}


#include <bits/stdc++.h>
#define rep(i,l,r) for(int i=int(l);i<int(r);i++)
#define put(x) cout<<#x<<" = "<<x<<endl;
#define X first
#define Y second
#define pb push_back
#define pp pop_back
#define in num
using namespace std;
typedef long long num;
typedef long double lod;
typedef pair<int,int> point;

int k,t,d,c;
lod ans;
int32_t main(){
    cin>>k>>d>>t;
    t*=2;
    d=((k+d-1)/d)*d;
    c=t/(d+k);
    ans=d*c;
    t-=(t/(d+k))*(d+k);
    if(2*k>=t){
	ans+=t/lod(2);
    }else{
	t-=2*k;
	ans+=k+t;
    }
    cout<<setprecision(20)<<fixed;
    cout<<ans<<endl;
}


#include <bits/stdc++.h>
#define rep(i,l,r) for(int i=int(l);i<int(r);i++)
#define put(x) cout<<#x<<" = "<<x<<endl;
#define X first
#define Y second
#define pb push_back
#define pp pop_back
#define int num
using namespace std;
typedef long long num;
typedef long double lod;
typedef pair<int,int> point;

int k,t,d,c;
lod ans;
int32_t main(){
    cin>>k>>d>>t;
    t*=2;
    d=((k+d-1)/d)*d;
    c=t/(d+k);
    ans=d*c;
    t-=(t/(d+k))*(d+k);
    if(2*k>=t){
	ans+=t/lod(2);
    }else{
	t-=2*k;
	ans+=k+t;
    }
    cout<<setprecision(20)<<fixed;
    cout<<ans<<endl;
}


//Bartek Kostka
//  You are not prepared!

#include "bits/stdc++.h"

using namespace std;

#define x first
#define y second
#define SZ(x) int(x.size())
#define ll long long
#define pii pair <int, int>
#define vi vector <int>
#define double long double

int main()
{
  ios_base::sync_with_stdio(0);
  double k, d, t;
  cin >> k >> d >> t;
  double bede = ceil(k/d)*d;
  double ilegotuje = k+(bede-k)/2.0;
  int okresy = floor(t/ilegotuje);
  double ans = bede*okresy;
  double pozostaly = t - ilegotuje*okresy;
  cout << fixed << setprecision(20);
  if(pozostaly <= k) {
    cout << ans + pozostaly << "\n";
  } else {
    cout << ans + k + 2*(pozostaly-k) << "\n";
  }

  return 0;
}


//Bartek Kostka
//  You are not prepared!

#include "bits/stdc++.h"

using namespace std;

#define x first
#define y second
#define SZ(x) int(x.size())
#define ll long long
#define pii pair <int, int>
#define vi vector <int>

int main()
{
  ios_base::sync_with_stdio(0);
  double k, d, t;
  cin >> k >> d >> t;
  double bede = ceil(k/d)*d;
  double ilegotuje = k+(bede-k)/2.0;
  int okresy = floor(t/ilegotuje);
  double ans = bede*okresy;
  double pozostaly = t - ilegotuje*okresy;
  cout << fixed << setprecision(20);
  if(pozostaly <= k) {
    cout << ans + pozostaly << "\n";
  } else {
    cout << ans + k + 2*(pozostaly-k) << "\n";
  }

  return 0;
}


//Bartek Kostka
//  You are not prepared!

#include "bits/stdc++.h"

using namespace std;

#define x first
#define y second
#define SZ(x) int(x.size())
#define ll long long
#define pii pair <int, int>
#define vi vector <int>
#define double long double

int main()
{
  ios_base::sync_with_stdio(0);
  double k, d, t;
  cin >> k >> d >> t;
  double bede = ceil(k/d)*d;
  double ilegotuje = k+(bede-k)/2.0;
  long long okresy = floor(t/ilegotuje);
  double ans = bede*okresy;
  double pozostaly = t - ilegotuje*okresy;
  cout << fixed << setprecision(20);
  if(pozostaly <= k) {
    cout << ans + pozostaly << "\n";
  } else {
    cout << ans + k + 2*(pozostaly-k) << "\n";
  }

  return 0;
}


//problem::https://codeforces.com/problemset/problem/948/A
//problem::https://codeforces.com/contest/699/problem/A
//problem::https://codeforces.com/problemset/problem/955/A
//problem::https://codeforces.com/problemset/problem/546/B
//problem::https://codeforces.com/problemset/problem/676/A
//problem::https://codeforces.com/problemset/problem/936/A
#include <bits/stdc++.h>
using namespace std;

void Protect_Sheep_Solution()
{
    int n,m;
    cin>>n>>m;
    char a[n][m];

    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            cin>>a[i][j];
        }
    }
    int flag=1;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            if(a[i][j]=='W')
            {
                int x[]={1,-1,0,0};
                int y[]={0,0,1,-1};
                for(int k=0;k<4;k++)
                {
                    int LR=x[k]+i;
                    int UD=y[k]+j;
                    if(LR>=0&&LR<n&&UD>=0&&UD<m)
                    {
                        if(a[LR][UD]=='S') {flag=0;break;}
                        else if(a[LR][UD]=='.') a[LR][UD]='D';
                    }
                }

            }
            if(!flag) break;
        }
        if(!flag) break;
    }
    if(flag){
        cout<<"YES"<<endl;
            for(int i=0;i<n;i++)
            {
                for(int j=0;j<m;j++)
                cout<<a[i][j];
                cout<<endl;
            }
            return;
    }
    cout<<"NO";
}

void  Launch_of_Collider_Solution()
{
    int n;
    cin>>n;
    string dir;
    cin>>dir;
    int minn=INT_MAX;
    int x,y;
    cin>>x;
    for(int i=1;i<n;i++)
    {
        cin>>y;

        if(dir[i-1]=='R'&&dir[i]=='L')
        {
                //x+t=y-t
                //2t=y-x
                //t=(y-x)/2
                int t=(y-x)/2;
                minn=min(t,minn);
        }
        x=y;
    }
if(minn==INT_MAX) cout<<-1;
else cout<<minn;
}

void Feed_the_cat_Solution()
{
    int hh,mm;
    cin>>hh>>mm;
    int H,D,C,N;
    cin>>H>>D>>C>>N;
    double required=ceil(double(H)/N);
    if(hh>=20)
    {
        double cost=required*C*80.0/100;
        cout<<cost;
        return;
    }
    double cost1=required*double(C);
    double time=0;
    if(mm==0)
    {
        time+=(20-hh)*60;
    }
    else {
        hh++;
        time+=(20-hh)*60+60-mm;
    }
    H+=D*(time);
    required=ceil(double(H)/N);
    double cost2=required*double(C)*80.0/100;
        cout<<min(cost1,cost2);
}

void Soldier_and_Badges_Solution()
{
  int n;
  cin>>n;
  set<int>s;
  int re=0;
  int a;
  for(int i=0;i<n;i++)
  {
        cin>>a;
        while(s.count(a))
        {
            a++;
            re++;
        }
        s.insert(a);
  }
  cout<<re;
}

void Nicholas_and_Permutation()
{
    int n;
    cin>>n;
    int index1,index2;
    int minn=INT_MAX,maxx=INT_MIN;
    int x;
    for(int i=0;i<n;i++)
    {
        cin>>x;
        if(x<minn)
        {
            index1=i;
            minn=x;
        }
        if(x>maxx)
        {
            index2=i;
            maxx=x;
        }
    }
    if(index1<index2)
    {
        cout<<max(index2,n-1-index1);
    }
    else
        {
            cout<<max(index1,n-1-index2);
        }
}

void Save_Energy_Solution()
{
   long long k, d, t;
    cin>>k>>d>>t;

    t *= 2;

    d = (k + d - 1) / d * d;//if comes every second so it is always run

    long long time = 2 * k + (d - k);
    long long timeR = t % time;

    cout << d * (t / time) + (timeR > 2 * k ? (timeR - 2 * k) + k + 0.0 : timeR / 2.0) << endl;

}
int main()
{
    //Protect_Sheep_Solution();
    //Launch_of_Collider_Solution();
    //Feed_the_cat_Solution();
    //Soldier_and_Badges_Solution();
    //Nicholas_and_Permutation();
    Save_Energy_Solution();
    return 0;
}


//problem::https://codeforces.com/problemset/problem/948/A
//problem::https://codeforces.com/contest/699/problem/A
//problem::https://codeforces.com/problemset/problem/955/A
//problem::https://codeforces.com/problemset/problem/546/B
//problem::https://codeforces.com/problemset/problem/676/A
//problem::https://codeforces.com/problemset/problem/936/A
#include <bits/stdc++.h>
using namespace std;

void Protect_Sheep_Solution()
{
    int n,m;
    cin>>n>>m;
    char a[n][m];

    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            cin>>a[i][j];
        }
    }
    int flag=1;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            if(a[i][j]=='W')
            {
                int x[]={1,-1,0,0};
                int y[]={0,0,1,-1};
                for(int k=0;k<4;k++)
                {
                    int LR=x[k]+i;
                    int UD=y[k]+j;
                    if(LR>=0&&LR<n&&UD>=0&&UD<m)
                    {
                        if(a[LR][UD]=='S') {flag=0;break;}
                        else if(a[LR][UD]=='.') a[LR][UD]='D';
                    }
                }

            }
            if(!flag) break;
        }
        if(!flag) break;
    }
    if(flag){
        cout<<"YES"<<endl;
            for(int i=0;i<n;i++)
            {
                for(int j=0;j<m;j++)
                cout<<a[i][j];
                cout<<endl;
            }
            return;
    }
    cout<<"NO";
}

void  Launch_of_Collider_Solution()
{
    int n;
    cin>>n;
    string dir;
    cin>>dir;
    int minn=INT_MAX;
    int x,y;
    cin>>x;
    for(int i=1;i<n;i++)
    {
        cin>>y;

        if(dir[i-1]=='R'&&dir[i]=='L')
        {
                //x+t=y-t
                //2t=y-x
                //t=(y-x)/2
                int t=(y-x)/2;
                minn=min(t,minn);
        }
        x=y;
    }
if(minn==INT_MAX) cout<<-1;
else cout<<minn;
}

void Feed_the_cat_Solution()
{
    int hh,mm;
    cin>>hh>>mm;
    int H,D,C,N;
    cin>>H>>D>>C>>N;
    double required=ceil(double(H)/N);
    if(hh>=20)
    {
        double cost=required*C*80.0/100;
        cout<<cost;
        return;
    }
    double cost1=required*double(C);
    double time=0;
    if(mm==0)
    {
        time+=(20-hh)*60;
    }
    else {
        hh++;
        time+=(20-hh)*60+60-mm;
    }
    H+=D*(time);
    required=ceil(double(H)/N);
    double cost2=required*double(C)*80.0/100;
        cout<<min(cost1,cost2);
}

void Soldier_and_Badges_Solution()
{
  int n;
  cin>>n;
  set<int>s;
  int re=0;
  int a;
  for(int i=0;i<n;i++)
  {
        cin>>a;
        while(s.count(a))
        {
            a++;
            re++;
        }
        s.insert(a);
  }
  cout<<re;
}

void Nicholas_and_Permutation()
{
    int n;
    cin>>n;
    int index1,index2;
    int minn=INT_MAX,maxx=INT_MIN;
    int x;
    for(int i=0;i<n;i++)
    {
        cin>>x;
        if(x<minn)
        {
            index1=i;
            minn=x;
        }
        if(x>maxx)
        {
            index2=i;
            maxx=x;
        }
    }
    if(index1<index2)
    {
        cout<<max(index2,n-1-index1);
    }
    else
        {
            cout<<max(index1,n-1-index2);
        }
}

void Save_Energy_Solution()
{
    int k,d,t;
    bool ON=1;
    cin>>k>>d>>t;
    int t2=2*t;
    double re=0;
   int i=0;
   int y=0;
   int done=0;
   while(!done)
   {
    if(i%d==0) ON=1;
    if(ON) {
            for(int j=0;j<k;j++)
            {
                re++;
                i++;
                y+=2;
                if(y==t2+1){done=1;re-=0.5; break;}
                if(y==t2) {done=1; break;}
            }
            ON=0;
    }
    else
    {
        i++;
        re+=1;
        y+=1;
        if(y==t2) {done=1;break;}
    }

   }
   cout<<re;
}
int main()
{
    //Protect_Sheep_Solution();
    //Launch_of_Collider_Solution();
    //Feed_the_cat_Solution();
    //Soldier_and_Badges_Solution();
    //Nicholas_and_Permutation();
    Save_Energy_Solution();
    return 0;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll k, d, t;
int main()
{
//freopen("936A.inp", "r", stdin);
cin >> k >> d >> t;
ll preriod = k + d - 1;
ll cook = k + preriod;
ll num = 2 * t / cook;
ll remain = 2 * t - num * cook;
cout << fixed << setprecision(9);
if(remain <= 2 * k) cout << num * preriod + remain * 1.0 / 2;
else cout << num * preriod + k + (remain - 2 * k);
}


//problem::https://codeforces.com/problemset/problem/948/A
//problem::https://codeforces.com/contest/699/problem/A
//problem::https://codeforces.com/problemset/problem/955/A
//problem::https://codeforces.com/problemset/problem/546/B
//problem::https://codeforces.com/problemset/problem/676/A
//problem::https://codeforces.com/problemset/problem/936/A
#include <bits/stdc++.h>
using namespace std;

void Protect_Sheep_Solution()
{
    int n,m;
    cin>>n>>m;
    char a[n][m];

    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            cin>>a[i][j];
        }
    }
    int flag=1;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            if(a[i][j]=='W')
            {
                int x[]={1,-1,0,0};
                int y[]={0,0,1,-1};
                for(int k=0;k<4;k++)
                {
                    int LR=x[k]+i;
                    int UD=y[k]+j;
                    if(LR>=0&&LR<n&&UD>=0&&UD<m)
                    {
                        if(a[LR][UD]=='S') {flag=0;break;}
                        else if(a[LR][UD]=='.') a[LR][UD]='D';
                    }
                }

            }
            if(!flag) break;
        }
        if(!flag) break;
    }
    if(flag){
        cout<<"YES"<<endl;
            for(int i=0;i<n;i++)
            {
                for(int j=0;j<m;j++)
                cout<<a[i][j];
                cout<<endl;
            }
            return;
    }
    cout<<"NO";
}

void  Launch_of_Collider_Solution()
{
    int n;
    cin>>n;
    string dir;
    cin>>dir;
    int minn=INT_MAX;
    int x,y;
    cin>>x;
    for(int i=1;i<n;i++)
    {
        cin>>y;

        if(dir[i-1]=='R'&&dir[i]=='L')
        {
                //x+t=y-t
                //2t=y-x
                //t=(y-x)/2
                int t=(y-x)/2;
                minn=min(t,minn);
        }
        x=y;
    }
if(minn==INT_MAX) cout<<-1;
else cout<<minn;
}

void Feed_the_cat_Solution()
{
    int hh,mm;
    cin>>hh>>mm;
    int H,D,C,N;
    cin>>H>>D>>C>>N;
    double required=ceil(double(H)/N);
    if(hh>=20)
    {
        double cost=required*C*80.0/100;
        cout<<cost;
        return;
    }
    double cost1=required*double(C);
    double time=0;
    if(mm==0)
    {
        time+=(20-hh)*60;
    }
    else {
        hh++;
        time+=(20-hh)*60+60-mm;
    }
    H+=D*(time);
    required=ceil(double(H)/N);
    double cost2=required*double(C)*80.0/100;
        cout<<min(cost1,cost2);
}

void Soldier_and_Badges_Solution()
{
  int n;
  cin>>n;
  set<int>s;
  int re=0;
  int a;
  for(int i=0;i<n;i++)
  {
        cin>>a;
        while(s.count(a))
        {
            a++;
            re++;
        }
        s.insert(a);
  }
  cout<<re;
}

void Nicholas_and_Permutation()
{
    int n;
    cin>>n;
    int index1,index2;
    int minn=INT_MAX,maxx=INT_MIN;
    int x;
    for(int i=0;i<n;i++)
    {
        cin>>x;
        if(x<minn)
        {
            index1=i;
            minn=x;
        }
        if(x>maxx)
        {
            index2=i;
            maxx=x;
        }
    }
    if(index1<index2)
    {
        cout<<max(index2,n-1-index1);
    }
    else
        {
            cout<<max(index1,n-1-index2);
        }
}

void Save_Energy_Solution()
{
   long long k, d, t;
    cin>>k>>d>>t;

    t *= 2;

    d = (k + d - 1) / d * d;//if comes every second so it is always run

    long long time = 2 * k + (d - k);
    long long timeR = t % time;
    cout.precision(20);

    cout << d * (t / time) + (timeR > 2 * k ? (timeR - 2 * k) + k + 0.0 : timeR / 2.0) << endl;

}
int main()
{
    //Protect_Sheep_Solution();
    //Launch_of_Collider_Solution();
    //Feed_the_cat_Solution();
    //Soldier_and_Badges_Solution();
    //Nicholas_and_Permutation();
    Save_Energy_Solution();
    return 0;
}


//problem::https://codeforces.com/problemset/problem/948/A
//problem::https://codeforces.com/contest/699/problem/A
//problem::https://codeforces.com/problemset/problem/955/A
//problem::https://codeforces.com/problemset/problem/546/B
//problem::https://codeforces.com/problemset/problem/676/A
//problem::https://codeforces.com/problemset/problem/936/A
#include <bits/stdc++.h>
using namespace std;

void Protect_Sheep_Solution()
{
    int n,m;
    cin>>n>>m;
    char a[n][m];

    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            cin>>a[i][j];
        }
    }
    int flag=1;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            if(a[i][j]=='W')
            {
                int x[]={1,-1,0,0};
                int y[]={0,0,1,-1};
                for(int k=0;k<4;k++)
                {
                    int LR=x[k]+i;
                    int UD=y[k]+j;
                    if(LR>=0&&LR<n&&UD>=0&&UD<m)
                    {
                        if(a[LR][UD]=='S') {flag=0;break;}
                        else if(a[LR][UD]=='.') a[LR][UD]='D';
                    }
                }

            }
            if(!flag) break;
        }
        if(!flag) break;
    }
    if(flag){
        cout<<"YES"<<endl;
            for(int i=0;i<n;i++)
            {
                for(int j=0;j<m;j++)
                cout<<a[i][j];
                cout<<endl;
            }
            return;
    }
    cout<<"NO";
}

void  Launch_of_Collider_Solution()
{
    int n;
    cin>>n;
    string dir;
    cin>>dir;
    int minn=INT_MAX;
    int x,y;
    cin>>x;
    for(int i=1;i<n;i++)
    {
        cin>>y;

        if(dir[i-1]=='R'&&dir[i]=='L')
        {
                //x+t=y-t
                //2t=y-x
                //t=(y-x)/2
                int t=(y-x)/2;
                minn=min(t,minn);
        }
        x=y;
    }
if(minn==INT_MAX) cout<<-1;
else cout<<minn;
}

void Feed_the_cat_Solution()
{
    int hh,mm;
    cin>>hh>>mm;
    int H,D,C,N;
    cin>>H>>D>>C>>N;
    double required=ceil(double(H)/N);
    if(hh>=20)
    {
        double cost=required*C*80.0/100;
        cout<<cost;
        return;
    }
    double cost1=required*double(C);
    double time=0;
    if(mm==0)
    {
        time+=(20-hh)*60;
    }
    else {
        hh++;
        time+=(20-hh)*60+60-mm;
    }
    H+=D*(time);
    required=ceil(double(H)/N);
    double cost2=required*double(C)*80.0/100;
        cout<<min(cost1,cost2);
}

void Soldier_and_Badges_Solution()
{
  int n;
  cin>>n;
  set<int>s;
  int re=0;
  int a;
  for(int i=0;i<n;i++)
  {
        cin>>a;
        while(s.count(a))
        {
            a++;
            re++;
        }
        s.insert(a);
  }
  cout<<re;
}

void Nicholas_and_Permutation()
{
    int n;
    cin>>n;
    int index1,index2;
    int minn=INT_MAX,maxx=INT_MIN;
    int x;
    for(int i=0;i<n;i++)
    {
        cin>>x;
        if(x<minn)
        {
            index1=i;
            minn=x;
        }
        if(x>maxx)
        {
            index2=i;
            maxx=x;
        }
    }
    if(index1<index2)
    {
        cout<<max(index2,n-1-index1);
    }
    else
        {
            cout<<max(index1,n-1-index2);
        }
}

void Save_Energy_Solution()
{
    int k,d,t;
    bool ON=1;
    cin>>k>>d>>t;
    int t2=2*t;
    double re=0;
   int i=0;
   int y=0;
   int done=0;
   while(!done)
   {
    if(i%d==0) ON=1;
    if(ON) {
            /*for(int j=0;j<k;j++)
            {
                re++;
                i++;
                y+=2;
                if(y==t2+1){done=1;re-=0.5; break;}
                if(y==t2) {done=1; break;}
            }*/
            int diff=t2-y;
            if(2*k==diff) {
                re+=k;
                y+=2*k;
                done=1;
                i+=k;
                break;
            }
            else if(diff>k*2)
            {
                re+=k;
                y+=2*k;
                i+=k;
                if(y==t2){done=1;break;}
            }
            else
            {
                if(diff%2==0)
                {
                    y=t2;
                    re+=diff/2;
                    if(y==t2){done=1;break;}
                }
                else {
                    y=t2;
                     re+=diff/2+0.5;
                    if(y==t2){done=1;break;}
                }
            }
            ON=0;
    }
    else
    {
        i++;
        re+=1;
        y+=1;
        if(y==t2) {done=1;break;}
    }

   }
   cout<<re;
}
int main()
{
    //Protect_Sheep_Solution();
    //Launch_of_Collider_Solution();
    //Feed_the_cat_Solution();
    //Soldier_and_Badges_Solution();
    //Nicholas_and_Permutation();
    Save_Energy_Solution();
    return 0;
}


#include<iostream>
#include<cstdlib>
#include<stdio.h>
#include<utility>
#include<vector>
typedef long long ll;
using namespace std;
int main()
{
    long long k,d,t;
    cin>> k>>d>>t;
    long long x;
    x=(k/d)*d;
    if(k%d) x+=d;

    long long iter_1=(2*t)/(x+k);
    double T1 = k+(x-k)*0.5;//实际周期长度
    //ll iter_1 = t/T1;//周期数

    // double remain=1.0-iter_1*(x+k)/(2.0*t);
    double used_time=iter_1*x;
    double st=t - ll(t/T1)*T1;
    if(st<k)
        used_time+=st;
    else
      used_time+=k+(st-k)*2;
    cout<<used_time<<endl;
    return 0;

  //ll k,d,t,T;
  //double ans= 0,st;
  //scanf("%lld%lld%lld",&k,&d,&t);
  //T=((k-1)/d+1)*d;//周期长度
  //double T1 = k+(T-k)*0.5;//实际周期长度
  //ll num = t/T1;//周期数
  //Ans=num*T;
  //st = t - ll(t/T1)*T1;
  //if(st<k)
  //  ans = ans+st;
  //else
  //  ans = ans+k+(st-k)*2;
  //printf("%.1lf",ans);
  //return 0;
}


#include<iostream>
#include<cstdlib>
#include<stdio.h>
#include<utility>
#include<vector>

using namespace std;
int main()
{
  long long k,d,t;
  cin>> k>>d>>t;
  int x;
  x=(k/d)*d;
  if(k%d) x+=d;
  int iter_1=(2*t)/(x+k);
  double remain=1.0-iter_1*(x+k)/(2.0*t);
  double used_time=iter_1*x;
  //cout<<"1\t"<<used_time<<endl;
  double most_cooked_on= k/(double)t;
  if(remain>most_cooked_on)
      used_time+=k;
  else
    used_time+=remain*t;
  //cout<<"2\t"<<used_time<<endl;
  remain-=k/(double)t;
  if(remain>0.00000000001)
    {
      used_time+=remain*2*t;
    }
  cout<<used_time<<endl;
  return 0;
}


#include<iostream>
#include<cstdlib>
#include<stdio.h>
#include<utility>
#include<vector>

using namespace std;
int main()
{
  long long k,d,t;
  cin>> k>>d>>t;
  long long x;
  x=(k/d)*d;
  if(k%d) x+=d;
  long long iter_1=(2*t)/(x+k);
  double remain=1.0-iter_1*(x+k)/(2.0*t);
  double used_time=iter_1*x;
  double st=remain*t;
  if(st<k)
    used_time+=st;
  else
    used_time+=k+(st-k)*2;
  cout<<used_time<<endl;
  return 0;
}


#include<iostream>
#include<cstdlib>
#include<stdio.h>
#include<utility>
#include<vector>
typedef long long ll;
using namespace std;
int main()
{
    long long k,d,t;
    cin>> k>>d>>t;
    long long x;
    x=(k/d)*d;
    if(k%d) x+=d;

    //long long iter_1=(2*t)/(x+k);
    double T1 = k+(x-k)*0.5;//实际周期长度
    ll iter_1 = t/T1;//周期数

    double remain=1.0-iter_1*(x+k)/(2.0*t);
    double used_time=iter_1*x;
    double st=remain*t;
    if(st<k)
        used_time+=st;
    else
      used_time+=k+(st-k)*2;
    cout<<used_time<<endl;
    return 0;

  //ll k,d,t,T;
  //double ans= 0,st;
  //scanf("%lld%lld%lld",&k,&d,&t);
  //T=((k-1)/d+1)*d;//周期长度
  //double T1 = k+(T-k)*0.5;//实际周期长度
  //ll num = t/T1;//周期数
  //Ans=num*T;
  //st = t - ll(t/T1)*T1;
  //if(st<k)
  //  ans = ans+st;
  //else
  //  ans = ans+k+(st-k)*2;
  //printf("%.1lf",ans);
  //return 0;
}


#include<iostream>
#include<cstdlib>
#include<stdio.h>
#include<utility>
#include<vector>

using namespace std;
int main()
{
  long long k,d,t;
  cin>> k>>d>>t;
  int x;
  x=(k/d)*d;
  if(k%d) x+=d;
  int iter_1=(2*t)/(x+k);
  double remain=1.0-iter_1*(x+k)/(2.0*t);
  double used_time=iter_1*x;
  used_time+=remain*t;
  remain-=k/(double)t;
  if(remain>0.00000000001)
    {
      used_time+=remain*2*t;
    }
  cout<<used_time<<endl;
  return 0;
}


#include<iostream>
#include<cstdlib>
#include<stdio.h>
#include<utility>
#include<vector>
typedef long long ll;
using namespace std;
int main()
{
  //  long long k,d,t;
  //  cin>> k>>d>>t;
  //  long long x;
  //  x=(k/d)*d;
  //  if(k%d) x+=d;
  //  long long iter_1=(2*t)/(x+k);
  //  double remain=1.0-iter_1*(x+k)/(2.0*t);
  //  double used_time=iter_1*x;
  //  double st=remain*t;
  //  if(st<k)
  //      used_time+=st;
  //  else
  //    used_time+=k+(st-k)*2;
  //  cout<<used_time<<endl;
  //  return 0;

  ll k,d,t,T;
  double ans= 0,st;
  scanf("%lld%lld%lld",&k,&d,&t);
  T=((k-1)/d+1)*d;//周期长度
  double T1 = k+(T-k)*0.5;//实际周期长度
  ll num = t/T1;//周期数
  ans=num*T;
  st = t - ll(t/T1)*T1;
  if(st<k)
    ans = ans+st;
  else
    ans = ans+k+(st-k)*2;
  printf("%.1lf",ans);
  return 0;
}


#include<iostream>
#include<cstdlib>
#include<stdio.h>
#include<utility>
#include<vector>
typedef long long ll;
using namespace std;
int main()
{
    long long k,d,t;
    cin>> k>>d>>t;
  //  long long x;
  //  x=(k/d)*d;
  //  if(k%d) x+=d;

     long long x=((k-1)/d+1)*d;//周期长度
    long long iter_1=(2*t)/(x+k);
    double remain=1.0-iter_1*(x+k)/(2.0*t);
    double used_time=iter_1*x;
    double st=remain*t;
    if(st<k)
        used_time+=st;
    else
      used_time+=k+(st-k)*2;
    cout<<used_time<<endl;
    return 0;

  //ll k,d,t,T;
  //double ans= 0,st;
  //scanf("%lld%lld%lld",&k,&d,&t);
  //T=((k-1)/d+1)*d;//周期长度
  //double T1 = k+(T-k)*0.5;//实际周期长度
  //ll num = t/T1;//周期数
  //ans=num*T;
  //st = t - ll(t/T1)*T1;
  //if(st<k)
  //  ans = ans+st;
  //else
  //  ans = ans+k+(st-k)*2;
  //printf("%.1lf",ans);
  //return 0;
}


#include<iostream>
#include<cstdlib>
#include<stdio.h>
#include<utility>
#include<vector>

using namespace std;

double save_energy()
{
  int k, d, t;
  cin>>k>>d>>t;
  if(t==0) return 0;
  double cooked_min[2];
  cooked_min[0]=1.0/t; //turned on
  cooked_min[1]=0.5/t; // turned off

  double used_time=0;
  int cur_t=0,flag,next_time;
  double cooked=0,most_cooked;
  while(1-cooked>0.0000001)
    {
      if(cur_t%d==0)
        {
          flag=0;
          most_cooked=cooked+cooked_min[flag]*k;
        }
      else
        {
          flag=1;
          next_time=cur_t/d+1;
          most_cooked=cooked+cooked_min[flag]*(next_time*d-cur_t);
        }

      if(1-most_cooked<0.00000001)
        {
          used_time+=(1-cooked)/cooked_min[flag];
          cooked=1.0;
        }
      else
        {
          int increase=(flag==0)? k : (next_time*d-cur_t);
          cur_t+=increase;
          cooked=most_cooked;
          used_time+=increase;
        }
      //cout<<cur_t<<'\t'<<cooked<<'\t'<<most_cooked<<'\t'<<used_time<<endl;
    }
  return used_time;

}
int main()
{
  cout<<save_energy()<<endl;
  return 0;
}


#include<iostream>
#include<cstdlib>
#include<stdio.h>
#include<utility>
#include<vector>
typedef long long ll;
using namespace std;
int main()
{
    long long k,d,t;
    cin>> k>>d>>t;
    //long long x;
    //x=(k/d)*d;
    //if(k%d) x+=d;
    long long x=((k-1)/d+1)*d;
    //long long iter_1=(2*t)/(x+k);
    double T1 = k+(x-k)*0.5;//实际周期长度
    ll iter_1 = t/T1;//周期数

    // double remain=1.0-iter_1*(x+k)/(2.0*t);
    double used_time=iter_1*x;
    double st=t - ll(t/T1)*T1;
    if(st<k)
        used_time+=st;
    else
      used_time+=k+(st-k)*2;
    cout<<used_time<<endl;
    return 0;

  //ll k,d,t,T;
  //double ans= 0,st;
  //scanf("%lld%lld%lld",&k,&d,&t);
  //T=((k-1)/d+1)*d;//周期长度
  //double T1 = k+(T-k)*0.5;//实际周期长度
  //ll num = t/T1;//周期数
  //Ans=num*T;
  //st = t - ll(t/T1)*T1;
  //if(st<k)
  //  ans = ans+st;
  //else
  //  ans = ans+k+(st-k)*2;
  //printf("%.1lf",ans);
  //return 0;
}


#include<iostream>
#include<cstdlib>
#include<stdio.h>
#include<utility>
#include<vector>
typedef long long ll;
using namespace std;
int main()
{
    long long k,d,t;
    cin>> k>>d>>t;
    long long x;
    x=(k/d)*d;
    if(k%d) x+=d;
    long long iter_1=(2*t)/(x+k);
    double remain=1.0-iter_1*(x+k)/(2.0*t);
    double used_time=iter_1*x;
    double st=remain*t;
    if(st<k)
        used_time+=st;
    else
      used_time+=k+(st-k)*2;
    printf("%.1lf",used_time);
    return 0;

 }


#include<iostream>
#include<cstdlib>
#include<stdio.h>
#include<utility>
#include<vector>

using namespace std;
int main()
{
  long long k,d,t;
  cin>> k>>d>>t;
  int x;
  x=(k/d)*d;
  if(k%d) x+=d;
  int iter_1=(2*t)/(x+k);
  double remain=1.0-iter_1*(x+k)/(2.0*t);
  double used_time=iter_1*x;
  double st=remain*t;
  if(st<k)
    used_time+=st;
  else
    used_time+=k+(st-k)*2;
  cout<<used_time<<endl;
  return 0;
}


#include<iostream>
#include<cstdlib>
#include<stdio.h>
#include<utility>
#include<vector>

#define LL long long
using namespace std;
int main()
{
  LL n, m, t, x, all, p, ans;
  scanf("%lld%lld%lld", &n, &m, &t);
  x = n/m*m;
  if(n%m)
    x += m;
  all = 2*t;
  p = n+x;
  ans = all/p*x;
  if(all%p<=2*n)
    {
      ans += (all%p)/2;
      printf("%lld", ans);
      if((all%p)%2)
        printf(".5");
      puts("");
    }
  else
    printf("%lld\n", ans+n+all%p-n*2);
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long double ll;
int  main()
{
    ll k,d,t;
    cin>>k>>d>>t;
    if((long long)k%(long long)d==0)
    {
        cout<<fixed<<t<<endl;
        return 0;
    }
    if(k>d)
    {
        ll a=(k/t)+(2*d-k)/(2*t);
        a=1/a;
        a=(long long)a;
        a=(ll)a;
       // cout<<fixed<<a<<endl;
        if((a*(k/t)+(2*d-k)/(2*t))+(k/t)>=1)
        {
            ll T=2*d*a + t*(1-a*((k/t)+(2*d-k)/(2*t)));
            cout<<setprecision(9)<<T<<endl;
            return 0;
        }
        ll T=2*d*a + k +2*t*(1-(a*((k/t)+(2*d-k)/(2*t)))-(k/t));
        cout<<setprecision(9)<<T<<endl;
    }
    else
    {
        ll a=(k/t)+(d-k)/(2*t);
        a=1/a;
        a=(long long )a;
        a=(ll)a;
       // cout<<fixed<<a<<endl;
         if((a*(k/t)+(d-k)/(2*t))+(k/t)>=1)
        {
            ll T=d*a + t*(1-a*((k/t)+(d-k)/(2*t)));
            cout<<setprecision(9)<<T<<endl;
            return 0;
        }
        ll T=d*a + k +2*t*(1-(a*((k/t)+(d-k)/(2*t)))-(k/t));
        cout<<setprecision(9)<<T<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long double ll;
int  main()
{
    ll k,d,t;
    cin>>k>>d>>t;
    if((long long)k%(long long)d==0)
    {
        cout<<fixed<<t<<endl;
        return 0;
    }
    if(k>d)
    {
        long long m;
        m=(k/d)+1;
        ll a=(k/t)+(m*d-k)/(2*t);
        a=1/a;
        a=(long long)a;
        a=(ll)a;
        //cout<<fixed<<a<<endl;
        if((a*(k/t)+(m*d-k)/(2*t))+(k/t)>=1)
        {
            ll T=m*d*a + t*(1-a*((k/t)+(m*d-k)/(2*t)));
            cout<<setprecision(9)<<T<<endl;
            return 0;
        }
        ll T=m*d*a + k +2*t*(1-(a*((k/t)+(m*d-k)/(2*t)))-(k/t));
        cout<<setprecision(9)<<T<<endl;
    }
    else
    {
        ll a=(k/t)+(d-k)/(2*t);
        a=1/a;
        a=(long long )a;
        a=(ll)a;
       // cout<<fixed<<a<<endl;
         if((a*(k/t)+(d-k)/(2*t))+(k/t)>=1)
        {
            ll T=d*a + t*(1-a*((k/t)+(d-k)/(2*t)));
            cout<<setprecision(9)<<T<<endl;
            return 0;
        }
        ll T=d*a + k +2*t*(1-(a*((k/t)+(d-k)/(2*t)))-(k/t));
        cout<<setprecision(9)<<T<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long double ll;
int  main()
{
    ll k,d,t;
    cin>>k>>d>>t;
    if((long long)k%(long long)d==0)
    {
        cout<<fixed<<t<<endl;
        return 0;
    }
    if(k>d)
    {
        long long m;
        m=(k/d)+1;
        ll a=(k/t)+(m*d-k)/(2*t);
        a=1/a;
        a=(long long)a;
        a=(ll)a;
        //cout<<fixed<<a<<endl;
        ll n=(k/t)+(m*d-k)/(2*t);
        //cout<<setprecision(9)<<a*n<<endl;
        if(a*n +(k/t)>=1)
        {
            ll T=m*d*a + t*(1-a*n);
            cout<<fixed<<setprecision(9)<<T<<endl;
            return 0;
        }
        ll T=m*d*a + k +2*t*(1-(a*n)-(k/t));
        cout<<fixed<<setprecision(9)<<T<<endl;
    }
    else
    {
        ll a=(k/t)+(d-k)/(2*t);
        a=1/a;
        a=(long long )a;
        a=(ll)a;
        ll n=(k/t)+(d-k)/(2*t);
       // cout<<fixed<<a<<endl;
        if(a*n+(k/t)>=1)
        {
            ll T=d*a + t*(1-a*n);
            cout<<fixed<<setprecision(9)<<T<<endl;
            return 0;
        }
        ll T=d*a + k +2*t*(1-(a*n)-(k/t));
        cout<<fixed<<setprecision(9)<<T<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long double ll;
int  main()
{
    ll k,d,t;
    cin>>k>>d>>t;
    if((long long)k%(long long)d==0)
    {
        cout<<fixed<<t<<endl;
        return 0;
    }
    if(k>d)
    {
        long long m;
        m=(k/d)+1;
        ll a=(k/t)+(m*d-k)/(2*t);
        a=1/a;
        a=(long long)a;
        a=(ll)a;
        //cout<<fixed<<a<<endl;
        if((a*(k/t)+(m*d-k)/(2*t))+(k/t)>=1)
        {
            ll T=m*d*a + t*(1-a*((k/t)+(m*d-k)/(2*t)));
            cout<<fixed<<setprecision(9)<<T<<endl;
            return 0;
        }
        ll T=m*d*a + k +2*t*(1-(a*((k/t)+(m*d-k)/(2*t)))-(k/t));
        cout<<fixed<<setprecision(9)<<T<<endl;
    }
    else
    {
        ll a=(k/t)+(d-k)/(2*t);
        a=1/a;
        a=(long long )a;
        a=(ll)a;
       // cout<<fixed<<a<<endl;
         if((a*(k/t)+(d-k)/(2*t))+(k/t)>=1)
        {
            ll T=d*a + t*(1-a*((k/t)+(d-k)/(2*t)));
            cout<<fixed<<setprecision(9)<<T<<endl;
            return 0;
        }
        ll T=d*a + k +2*t*(1-(a*((k/t)+(d-k)/(2*t)))-(k/t));
        cout<<fixed<<setprecision(9)<<T<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long double ll;
int  main()
{
    ll k,d,t;
    cin>>k>>d>>t;
    if((long long)k%(long long)d==0)
    {
        cout<<fixed<<t<<endl;
        return 0;
    }
    if(k>d)
    {
        ll a=(k/t)+(2*d-k)/(2*t);
        a=1/a;
        a=(long long)a;
        a=(ll)a;
        cout<<fixed<<a<<endl;
        if((a*(k/t)+(2*d-k)/(2*t))+(k/t)>=1)
        {
            ll T=2*d*a + t*(1-a*((k/t)+(2*d-k)/(2*t)));
            cout<<setprecision(9)<<T<<"*"<<endl;
            return 0;
        }
        ll T=2*d*a + k +2*t*(1-(a*((k/t)+(2*d-k)/(2*t)))-(k/t));
        cout<<setprecision(9)<<T<<endl;
    }
    else
    {
        ll a=(k/t)+(d-k)/(2*t);
        a=1/a;
        a=(long long )a;
        a=(ll)a;
        cout<<fixed<<a<<endl;
         if((a*(k/t)+(d-k)/(2*t))+(k/t)>=1)
        {
            ll T=d*a + t*(1-a*((k/t)+(d-k)/(2*t)));
            cout<<setprecision(9)<<T<<"*"<<endl;
            return 0;
        }
        ll T=d*a + k +2*t*(1-(a*((k/t)+(d-k)/(2*t)))-(k/t));
        cout<<setprecision(9)<<T<<endl;
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <map>
#include <set>
using namespace std;

int main() {
    long long t, k, d;
    cin >> k >> d >> t;
    long long del = (k + d - 1) / d;
    long long h = del * d;
    double off = h - k;
    double on = k;
    long long full = 2 * t / (int) (2 * on + off);
    long long left = 2 * t - full * (2 * on + off);
    if (left == 0) {
        cout << full * h << endl;
        return 0;
    } else if (left <= 2 * on) {
        cout << full * h + (double)left / 2 << endl;
    } else {
        cout << full * h + on + (double)(left - on) / 2;
    }

}


#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <map>
#include <set>
using namespace std;

int main() {
    long long t, k, d;
    cin >> k >> d >> t;
    long long del = (k + d - 1) / d;
    long long h = del * d;
    long long off = h - k;
    long long on = k;
    long long full = 2 * t / (long long) (2 * on + off);
    long long left = 2 * t - full * (2 * on + off);
    //cout << on << ' ' << off << ' ' << full << ' ' << left << endl;
    if (left == 0) {
        cout << full * h << endl;
        return 0;
    } else if (left <= 2 * on) {
        cout << full * h + (double)left / 2 << endl;
    } else {
        cout << full * h + on + (left - 2 * on);
    }

}


#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <map>
#include <set>
#include <iomanip>
using namespace std;

int main() {
    long long t, k, d;
    cin >> k >> d >> t;
    long long del = (k + d - 1) / d;
    long long h = del * d;
    long long off = h - k;
    long long on = k;
    long long full = 2 * t / (long long) (2 * on + off);
    long long left = 2 * t - full * (2 * on + off);
    //cout << on << ' ' << off << ' ' << full << ' ' << left << endl;
    if (left == 0) {
        cout << full * h << endl;
        return 0;
    } else if (left <= 2 * on) {
        cout << setprecision(20) << full * h + (double)left / 2 << endl;
    } else {
        cout << full * h + on + (left - 2 * on);
    }
}


#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <map>
#include <set>
using namespace std;

int main() {
    long long t, k, d;
    cin >> k >> d >> t;
    long long del = (k + d - 1) / d;
    long long h = del * d;
    long long off = h - k;
    long long on = k;
    long long full = 2 * t / (long long) (2 * on + off);
    long long left = 2 * t - full * (2 * on + off);
    if (left == 0) {
        cout << full * h << endl;
        return 0;
    } else if (left <= 2 * on) {
        cout << full * h + (double)left / 2 << endl;
    } else {
        cout << full * h + on + (double)(left - on) / 2;
    }

}


#include<bits/stdc++.h>
#define rep(i, n) for(int i = 1; i <= n; ++i)
using namespace std;
typedef long long ll;
ll k, d, t;

int main() {
    scanf("%lld%lld%lld", &k, &d, &t);
    if(k >= d) {
        ll m = k / d, l = k - m * d;
        if(l == 0) {
            printf("%lld\n", t);
            return 0;
        }

        ll need = t << 1LL, per = 2LL * k + (d - l);
        ll tim = (m + 1) * d;
        double ans = 0.0;
        ll cnt = need / per;
        ans += cnt * tim;
        need -= per * cnt;
        if(k * 2LL >= need) ans += (double)need / 2.0;
        else {
            need -= 2LL * k;
            ans += k;
            ans += need;
        }
        printf("%.10f\n", ans);
    } else {
        ll need = t << 1LL, per = d + k;
        double ans = 0.0;
        ll cnt = need / per;
        ans += cnt * d;
        need -= per * cnt;
        if(k * 2LL >= need) ans += (double)need / 2.0;
        else {
            need -= 2LL * k;
            ans += k;
            ans += need;
        }
        printf("%.10f\n", ans);
    }

    return 0;
}


#include<bits/stdc++.h>
#define rep(i, n) for(int i = 1; i <= n; ++i)
using namespace std;
typedef long long ll;
ll k, d, t;

double P(ll need, ll fast, ll slow) {
    ll per = fast * 2LL + slow;
    ll cnt = need / per;
    need -= cnt * per;
    double ans = cnt * (fast + slow);
    if(need <= fast * 2LL) ans += double(need) / 2.0;
    else ans += fast + (need - fast * 2LL);
    return ans;
}

int main() {
    scanf("%lld%lld%lld", &k, &d, &t);
    double ans = 0;
    if(k >= d) {
        ll m = k / d, l = k - m * d;
        if(l == 0) {
            printf("%lld\n", t);
            return 0;
        }
        ans = P(t << 1LL, k, d - l);
    } else {
        ans = P(t << 1LL, k, d - k);
    }
    printf("%.10f\n", ans);

    return 0;
}


//Be Name Khoda
//no comment...
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T> using ordered_multiset =  tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long ll;
typedef long double ld;
const int MOD = (int)1e9 + 7;
const int MAXN = (int)1e5 + 7;
const int infint = (int)1e9;
const ll inf = (ll)1e18;
ll k, d, t;
bool check(ld mid)
{
	ll tm = k / d;
	if(k % d)
		tm++;
	tm *= d;
	//0, tm, 2tm, 3tm, ..., xtm;
	ll nums = mid / tm;
	ld ons = nums * k;
	ld cnt = min((ld)k, mid - nums * tm);
	ons += cnt;
	ld ofs = mid - ons;
	if(2 * ons + ofs >= 2 * t)
		return 1;
	return 0;
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin >> k >> d >> t;
	ld l = 0, r = 1e18 + 6;
	for (int i = 0; i < 30000; i++)
	{
		ld mid = (l + r) / 2;
		if(check(mid))
			r = mid;
		else
			l = mid;
	}
	cout << fixed << setprecision(9) << r;
}


//Be Name Khoda
//no comment...
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T> using ordered_multiset =  tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long ll;
typedef long double ld;
const int MOD = (int)1e9 + 7;
const int MAXN = (int)1e5 + 7;
const int infint = (int)1e9;
const ll inf = (ll)1e18;
ll k, d, t;
bool check(ld mid)
{
	ll tm = k / d;
	if(k % d)
		tm++;
	tm *= d;
	//0, tm, 2tm, 3tm, ..., xtm;
	ll nums = mid / tm;
	ld ons = nums * k;
	ons += (mid - nums * tm);
	ld ofs = mid - ons;
	if(2 * ons + ofs >= 2 * t)
		return 1;
	return 0;
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin >> k >> d >> t;
	ld l = 0, r = 1e18;
	for (int i = 0; i < 2000; i++)
	{
		ld mid = (l + r) / 2;
		if(check(mid))
			r = mid;
		else
			l = mid;
	}
	cout << fixed << setprecision(9) << r;
}


//Be Name Khoda
//no comment...
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T> using ordered_multiset =  tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long ll;
typedef long double ld;
const int MOD = (int)1e9 + 7;
const int MAXN = (int)1e5 + 7;
const int infint = (int)1e9;
const ll inf = (ll)1e18;
ll k, d, t;
bool check(ld mid)
{
	ll tm = k / d;
	if(k % d)
		tm++;
	tm *= d;
	//0, tm, 2tm, 3tm, ..., xtm;
	ll nums = mid / tm;
	ld ons = nums * k;
	ld cnt = min((ld)k, mid - nums * tm);
	ons += cnt;
	ld ofs = mid - ons;
	if(2 * ons + ofs >= 2 * t)
		return 1;
	return 0;
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin >> k >> d >> t;
	ld l = 0, r = 3e18 + 6;
	for (int i = 0; i < 30000; i++)
	{
		ld mid = (l + r) / 2;
		if(check(mid))
			r = mid;
		else
			l = mid;
	}
	cout << fixed << setprecision(9) << r;
}


#include <bits/stdc++.h>
using namespace std;

long double k , d , t ;
long double get(){
	long double l = 0 , r = k , mid , ans = 1e18;
	while(l<=r){
		mid = ceil((l+r)/2);
		if(mid*d >= k){
			ans=min(ans,mid*d-k);
			r=mid-1;
		}else l=mid+1;
	}
	return ans;
}
long double howcan(long double can){
	long double l=0 , r=1e18+10 , mid , ans;
	while(l<=r){
		mid = ceil((l+r)/2);
		if(mid*can >= t){
			ans = mid;
			r=mid-1;
		}else l=mid+1;
	}
	return ans;
}
int main(){
	cin >> k >> d >> t;
	long double off = get();
	long double can = k+(off)/2.0;
	long double end = howcan(can)*can - t;
	long double howm = howcan(can)*(k+off);
	if(end>0){
		if(end <= off*0.5){
			howm -= end*2;
			end = 0;
		}else{
			end -= off/2.0;
			howm -= off;
		}
	}
	if(end > 0){
		howm-=end;
		end = 0;
	}
	cout<<fixed<<howm;
	return 0;
}


//you got a dream .. you gotta protect it
#include <bits/stdc++.h>
using namespace std;

long double k , d , t ;
long double get(){
	long double l = 0 , r = k , mid , ans = 1e18;
	while(l<=r){
		mid = ceil((l+r)/2);
		if(mid*d >= k){
			ans=min(ans,mid*d-k);
			r=mid-1;
		}else l=mid+1;
	}
	return ans;
}
long double howcan(long double can){
	long double l=0 , r=1e18+10 , mid , ans;
	while(l<=r){
		mid = ceil((l+r)/2);
		if(mid*can >= t){
			ans = mid;
			r=mid-1;
		}else l=mid+1;
	}
	return ans;
}
int main(){
	cin >> k >> d >> t;
	long double off = get();
	long double can = k+(off)/2.0;
	long double end = howcan(can)*can - t;
	long double howm = howcan(can)*(k+off);
	if(end>0){
		if(end <= off*0.5){
			howm -= end*2;
			end = 0;
		}else{
			end -= off/2.0;
			howm -= off;
		}
	}
	if(end > 0){
		howm-=end;
		end = 0;
	}
	cout<<fixed<<howm;
	return 0;
}


#include <stdio.h>
#include <math.h>

int main() {
    double k, d, t,ans, unitsleft, kmodd;
    scanf("%lf %lf %lf", &k, &d, &t);
    kmodd = k - d*floor(k/d);
    if(kmodd == 0) {
        ans = t;
    } else {
        unitsleft = t - floor(t/(k + 0.5*(d - kmodd)))*(k + 0.5*(d - kmodd));
        ans = floor(t/(k + 0.5*(d - kmodd)))*(k + d - kmodd);
        if(unitsleft <= k){
            ans += unitsleft;
        }
        else {
            ans += k + 2*(unitsleft-k);
        }
    }
    printf("%lf", ans);
return 0;
}


#include <stdio.h>
#include <math.h>

int main() {
    int k, d, t;
    double ans, unitsleft;
    scanf("%d %d %d", &k, &d, &t);
    if(k%d == 0) {
        ans = t;
    } else {
        unitsleft = t - floor(t/(k + 0.5*(d - k%d)))*(k + 0.5*(d - k%d));
        ans = floor(t/(k + 0.5*(d - k%d)))*(k + d - k%d);
        if(unitsleft <= k){
            ans += unitsleft;
        }
        else {
            ans += k + 2*(unitsleft-k);
        }
    }
    printf("%f", ans);
return 0;
}


#include <stdio.h>
#include <math.h>

int main() {
    int k, d, t, dtime;
    float tcycle, ncycles, ans;
    scanf("%d %d %d", &k, &d, &t);
    if(k%d == 0){
        ans = t;
    } else {
        dtime = d - k%d;
        tcycle = k + d - k%d;
        ncycles = floor(t/(k + 0.5*dtime));
        if(t/(k + 0.5*dtime) == ncycles) {
            ans = ncycles*tcycle;
        } else if(t - ncycles*(k + 0.5*dtime) <= k) {
                ans = ncycles*tcycle + t - ncycles*(k + 0.5*dtime);
            } else {
                ans = ncycles*tcycle + k + 2*(t - ncycles*(k + 0.5*dtime) - k);
            }
    }
    printf("%f", ans);
return 0;
}


#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main()
{
    long long k,d,t;
    cin>>k>>d>>t;
    double c;
    double time=0;
    double co=0;

    double rez=0;
    if (k%d==0)
    {
        cout<<t<<endl;
        return 0;
    }

    else {
    c=k+(d-(k%d));
    rez=double(k)/double(t);
    rez+=double(d-(k%d))/double(2*t);

    co=double(1)/double(rez);
    c*=trunc(co);

    double frac=co-trunc(co);
    if ((double(k)/double(t)>=(frac*rez)))
         {
             c+=frac*rez*t;

             cout<<setprecision(10)<<c<<endl;
             return 0;
         }
        else
        {
            frac*=rez;

            frac-=(double(k)/double(t));
            c+=k;
            c+=frac*2*t;
            cout<<setprecision(10)<<c;
            return 0;
        }
    }

}


#include <iostream>
#include <cmath>
using namespace std;
int main()
{
    long long k,d,t;
    cin>>k>>d>>t;
    double c;
    double time=0;
    double co=0;

    double rez=0;
    if (k%d==0)
    {
        cout<<t<<endl;
        return 0;
    }

    else {
    c=k+(d-(k%d));
    rez=double(k)/double(t);
    rez+=double(d-(k%d))/double(2*t);

    co=double(1)/double(rez);
    c*=int(co);

    double frac=co-int(co);
    if ((double(k)/double(t)>=(frac*rez)))
         {
             c+=frac*rez*t;
             cout<<c<<endl;
             return 0;
         }
        else
        {
            frac*=rez;

            frac-=(double(k)/double(t));
            c+=k;
            c+=frac*2*t;
            cout<<c;
            return 0;
                    }
    }

}


#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main()
{
    long long k,d,t;
    cin>>k>>d>>t;
    double c;
    double time=0;
    double co=0;

    double rez=0;
    if (k%d==0)
    {
        cout<<t<<endl;
        return 0;
    }

    else {
    c=k+(d-(k%d));
    rez=double(k)/double(t);
    rez+=double(d-(k%d))/double(2*t);

    co=double(1)/double(rez);
    c*=int(co);

    double frac=co-int(co);
    if ((double(k)/double(t)>=(frac*rez)))
         {
             c+=frac*rez*t;
             cout<<setprecision(10)<<c<<endl;
             return 0;
         }
        else
        {
            frac*=rez;

            frac-=(double(k)/double(t));
            c+=k;
            c+=frac*2*t;
            cout<<setprecision(10)<<c;
            return 0;
        }
    }

}


#include <bits/stdc++.h>

#define REP(i, a, b) for(int i = a; i <= b; i ++)
#define REPG(i, x) for(int i = head[x]; i; i = g[i].nxt)

#define clr(x, y) memset(x, y, sizeof(x))

using namespace std;

typedef long long LL;
typedef double LF;

LL Max(LL a, LL b){return a > b ? a : b;}
LL Min(LL a, LL b){return a < b ? a : b;}
LL abs(LL x){return x > 0 ? x : -x;}

inline LL read(){
	LL r = 0, z = 1; char ch = getchar();
	while(ch < '0' || ch > '9'){if(ch == '-') z = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9'){r = r * 10 + ch - '0'; ch = getchar();}
	return r * z;
}

void work(){
	LL k = read(), d = read(), t = read();
	LL g = k / d + (k % d ? 1 : 0), lst = g * d - k;
	LF once = (1.0 * (k + (LF)lst / 2.0)) / (1.0 * t);
	LL times = 1.0 / once; LF now = (LF)times * once;
	if(now + (LF)k / t >= 1.0){
		LF ned = 1.0 * (1.0 - now) * t;
		LF ans = 1.0 * times * g * d + ned;
		printf("%.9lf\n", ans);
	}
	else {
		now = now + 1.0 * (k / t);
		LF ans = 1.0 * (times * g * d + t);
		LF ned = 2.0 * (1.0 - now) * t;
		ans = ned + ans;
		printf("%.9lf\n", ans);
	}
}

int main(){
	work();
	return 0;
}


#include <bits/stdc++.h>

#define REP(i, a, b) for(int i = a; i <= b; i ++)
#define REPG(i, x) for(int i = head[x]; i; i = g[i].nxt)

#define clr(x, y) memset(x, y, sizeof(x))

using namespace std;

typedef long long LL;
typedef double LF;

LL Max(LL a, LL b){return a > b ? a : b;}
LL Min(LL a, LL b){return a < b ? a : b;}
LL abs(LL x){return x > 0 ? x : -x;}

inline int read(){
	int r = 0, z = 1; char ch = getchar();
	while(ch < '0' || ch > '9'){if(ch == '-') z = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9'){r = r * 10 + ch - '0'; ch = getchar();}
	return r * z;
}

void work(){
	int k = read(), d = read(), t = read();
	int g = k / d + (k % d ? 1 : 0), lst = g * d - k;
	LF once = (1.0 * (k + (LF)lst / 2.0)) / (1.0 * t);
	int times = 1.0 / once; LF now = (LF)times * once;
	if(now + (LF)k / t >= 1.0){
		LF ned = 1.0 * (1.0 - now) * t;
		LF ans = 1.0 * times * g * d + ned;
		printf("%.9lf\n", ans);
	}
	else {
		now = now + 1.0 * (k / t);
		LF ans = 1.0 * (times * g * d + t);
		LF ned = 2.0 * (1.0 - now) * t;
		ans = ned + ans;
		printf("%.9lf\n", ans);
	}
}

int main(){
	work();
	return 0;
}


#include <bits/stdc++.h>

#define REP(i, a, b) for(int i = a; i <= b; i ++)
#define REPG(i, x) for(int i = head[x]; i; i = g[i].nxt)

#define clr(x, y) memset(x, y, sizeof(x))

using namespace std;

typedef long long LL;
typedef double LF;

LL Max(LL a, LL b){return a > b ? a : b;}
LL Min(LL a, LL b){return a < b ? a : b;}
LL abs(LL x){return x > 0 ? x : -x;}

inline LL read(){
	LL r = 0, z = 1; char ch = getchar();
	while(ch < '0' || ch > '9'){if(ch == '-') z = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9'){r = r * 10 + ch - '0'; ch = getchar();}
	return r * z;
}

void work(){
	LL k = read(), d = read(), t = read(), T; LF ans = 0, lst;
	T = ((k - 1) / d + 1) * d;		//周期长度
	LF T1 = k + (T - k) * 0.5;		//一个周期实际烘烤时间
	LL times = t / T1;				//正周期个数
	ans = times * T;
	lst = t - LL(t / T1) * T1;
	if(lst < k) ans = ans + lst;
	else ans = ans + k + (lst - k) * 2;
	printf("%.1lf", ans);
}

int main(){
	work();
	return 0;
}


#include <iostream>
using namespace std;
typedef long long ll;
int main(){
	ll k,d,t;
	long double ans=0;
	cin>>k>>d>>t;
	if(k%d==0) cout<<t<<endl;
	else{
		long double x=(double)(d-(k%d))/2+k;
		ll y=d-(k%d)+k;
		ans+=(ll)(t/x)*(y-x)+t;
		cout<<ans<<endl;
	}
}


#include <iostream>
using namespace std;
typedef long long ll;
int main(){
	ll k,d,t;
	cin>>k>>d>>t;
	if(k%d==0) cout<<t<<endl;
	else{
		long double x=(double)(d-(k%d))/2+k;
		ll z=x;
		ll y=d-(k%d)+k;
		if(z==x) {
			ll ans=(ll)(t/x)*(y-x)+t;
			cout<<ans<<endl;
		}
		else {
			long double ans=(ll)(t/x)*(y-x)+t;
			cout<<ans<<endl;
		}
	}
}


#include <iostream>
using namespace std;
typedef long long ll;
int main(){
	ll k,d,t;
	cin>>k>>d>>t;
	if(k%d==0) cout<<t<<endl;
	else{
		long double x=(double)(d-(k%d))/2+k;
		ll z=x;
		ll y=d-(k%d)+k;
		if(z==x) {
			ll ans=(ll)(t/x)*y;
			if((t-(ll)(t/x)*x)<=k) ans+=t-(ll)(t/x)*x;
			else ans+=k+(t-(ll)(t/x)*x-k)*2;
			cout<<ans<<endl;
		}
		else {
			long double ans=(ll)(t/x)*y;
			if((t-(ll)(t/x)*x)<=k) ans+=t-(ll)(t/x)*x;
			else ans+=k+(t-(ll)(t/x)*x-k)*2;
			if(ans<1e7) cout<<ans<<endl;
			else cout<<(ll)(ans)<<endl;
		}
	}
}


#include <iostream>
using namespace std;
typedef long long ll;
int main(){
	ll k,d,t;
	cin>>k>>d>>t;
	if(k%d==0) cout<<t<<endl;
	else{
		long double x=(double)(d-(k%d))/2+k;
		ll z=x;
		ll y=d-(k%d)+k;
		if(z==x) {
			ll ans=(ll)(t/x)*y+t;
			if((t-(ll)(t/x)*x)<=k) ans+=t-(ll)(t/x)*x;
			else ans+=k+(t-(ll)(t/x)*x-k)*2;
			cout<<ans<<endl;
		}
		else {
			long double ans=(ll)(t/x)*y;
			if((t-(ll)(t/x)*x)<=k) ans+=t-(ll)(t/x)*x;
			else ans+=k+(t-(ll)(t/x)*x-k)*2;
			cout<<ans<<endl;
		}
	}
}


#include <iostream>
using namespace std;
typedef long long ll;
int main(){
	ll k,d,t;
	cin>>k>>d>>t;
	if(k%d==0) cout<<t<<endl;
	else{
		long double x=(double)(d-(k%d))/2+k;
		ll z=x;
		ll y=d-(k%d)+k;
		if(z==x) {
			ll ans=(ll)(t/x)*y;
			if((t-(ll)(t/x)*x)<=k) ans+=t-(ll)(t/x)*x;
			else ans+=k+(t-(ll)(t/x)*x-k)*2;
			cout<<ans<<endl;
		}
		else {
			long double ans=(ll)(t/x)*y;
			if((t-(ll)(t/x)*x)<=k) ans+=t-(ll)(t/x)*x;
			else ans+=k+(t-(ll)(t/x)*x-k)*2;
			cout<<ans<<endl;
		}
	}
}


#include <iostream>
using namespace std;
typedef long long ll;
int main(){
	ll k,d,t;
	double ans=0;
	cin>>k>>d>>t;
	if(k%d==0) cout<<t<<endl;
	else{
		double x=(double)(d-(k%d))/2+k;
		ll y=d-(k%d)+k;
		ans+=(ll)(t/x)*(y-x)+t;
		cout<<ans<<endl;
	}
}


#include <iostream>
using namespace std;
typedef long long ll;
int main(){
	ll k,d,t;
	cin>>k>>d>>t;
	if(k%d==0) cout<<t<<endl;
	else{
		long double x=(double)(d-(k%d))/2+k;
		ll z=x;
		ll y=d-(k%d)+k;
		if(z==x) {
			ll ans=(ll)(t/x)*(y-x)+t;
			if((t-(ll)(t/x)*x)<=k) ans+=t-(ll)(t/x)*x;
			else ans+=k+(t-(ll)(t/x)*x-k)*2;
			cout<<ans<<endl;
		}
		else {
			long double ans=(ll)(t/x)*y;
			if((t-(ll)(t/x)*x)<=k) ans+=t-(ll)(t/x)*x;
			else ans+=k+(t-(ll)(t/x)*x-k)*2;
			cout<<ans<<endl;
		}
	}
}


#include <bits/stdc++.h>
using namespace std;
long long k, d, t;
int main()
{
#ifdef _noname
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	scanf("%I64d%I64d%I64d", &k, &d, &t);
	t *= 2;
	long long tot1 = ((k - 1) / d + 1) * d;//tot1 + k
	long long tot2 = tot1 + k;
	long long ans = t / tot2 * tot1;
	t %= tot2;
	if (t <= k * 2) printf("%.8lf\n", (double)t / 2 + ans);
	else printf("%.8lf\n", -(double)k / 2 + ans + t);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
long long k, d, t;
int main()
{
#ifdef _noname
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	scanf("%I64d%I64d%I64d", &k, &d, &t);
	t *= 2;
	long long tot1 = ((k - 1) / d + 1) * d;//tot1 + k
	long long tot2 = tot1 + k;
	long long ans = t / tot2 * tot1;
	t %= tot2;
	if (t <= k * 2)
	{
		if (t % 2) printf("%I64d.5\n", t / 2 + ans);
		else printf("%I64d\n", t / 2 + ans);
	}
	else printf("%I64d\n", ans + t - k);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
long long k, d, t;
int main()
{
#ifdef _noname
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	scanf("%I64d%I64d%I64d", &k, &d, &t);
	t *= 2;
	long long tot1 = ((k - 1) / d + 1) * d;//tot1 + k
	long long tot2 = tot1 + k;
	long long ans = t / tot2 * tot1;
	t %= tot2;
	if (t <= k * 2)
	{
		if (t % 2) printf("%I64d.5\n", t / 2 + ans);
		else printf("%I64d\n", t / 2 + ans);
	}
	else
	{
		if (k % 2) printf("%I64d.5\n", ans + t - (k + 1) / 2);
		else printf("%I64d\n", ans + t - (k + 1) / 2);
	}
	return 0;
}


#include<bits/stdc++.h>

#define db double
#define int long long
int k,d,t;
signed main(){
	std::cin>>k>>d>>t;
	int T=((k-1)/d+1)*d;
	db fi=(T-k)/2.0+k;
	db ret=floor(t/fi)*T,remain=t-floor(t/fi)*fi;
	printf("%.10lf\n",remain<k?ret+remain:ret+remain*2-k);
	return 0;
}


#include <iostream>
#include <cmath>
using namespace std;

int main()
{
    double dx1,dx2,k,t,d,anst = 0,ansd = 0,dxd = 0,dt;
    cin >>k>>t>>d;
    //double ;
    dt = t;
    while(dt<k) dt+=t;
    //cout<<dt<<endl;
    dx1 = k;
    dx2 = dt-k;
    dxd = k+(dt-k)*0.5;
    //cout<<dxd <<endl;
    //cout<<dt<<endl;
    //cout<<k;
    //cout <<dxd<<endl;
    double s,e;
    while(ansd<d)
    {
        ansd+=dxd;
        anst+=dt;
    }
    while(ansd!=d)
    {
        //cout <<"1"<<endl;
        if(ansd > d)
        {
            e = anst;
            s = anst - t;
            anst = (s+e)/2.0;
            //cout <<anst<<endl;
            t/=2.0;
        }
        else if(ansd<d)
        {
            s = anst;
            e = anst + t;
            anst = (s+e)/2.0;
            //cout <<anst<<endl;
            t/=2.0;
        }
        double yu = 0;
        int i = 0;
        long long anst2 = anst;
        anst2 = ((long long)anst2)/dt;
        yu = anst-anst2*dt;
        //
        if(yu<=dx1)
        {
            ansd = anst2*dxd+yu;
        }
        else
        {
            ansd = anst2*dxd + k + (yu-k)/2.0;
        }
        //cout<<ansd<<endl;
    }
    printf("%.9f\n",anst);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
    ll n;
    cin>>n;
    ll a=0,b=0;
    ll ca=0,cb=0;
    for(ll i=0;i<n;i++){
        ll x,t,y;
        cin>>t>>x>>y;
        if(t==1){
            a+=x;
            ca+=10;
        }
        else{
            b+=x;
            cb+=10;
        }
    }
    ca/=2;
    cb/=2;
    if(a>=ca){
        cout<<"LIVE"<<endl;
    }
    else{
        cout<<"DEAD"<<endl;
    }
    if(b>=cb){
        cout<<"LIVE"<<endl;
    }
    else{
        cout<<"DEAD"<<endl;
    }
    return 0
}