#include <bits/stdc++.h>
using namespace std;
const double eps = 1E-9;
const double Exp = 2.7182818284590452354;
const int Max_Bit = 63;
const int INF = 1000000007;
const long long LINF = 1000000000000000007ll;
const int MOD = 1000000007;
const int NMAX = 1e+5 + 5;
const int MMAX = 1e+7 + 5;
const int base = 1e+9;
long long k, d, t;
int main() {
  cin >> k >> d >> t;
  long long a = (k <= d) ? d : ((k + d - 1) / d * d);
  long long b = k + a;
  long long c = t * 2 / b;
  long long e = t * 2 - c * b;
  bool real = (e <= k * 2 && e % 2 == 1);
  long long ans = (e > k * 2) ? (c * a + e - k) : (c * a + e / 2);
  cout << ans;
  if (real) cout << ".5";
  cout << endl;
  return 0;
}
