#include <bits/stdc++.h>
using namespace std;
int main() {
  long long k, d, t;
  cin >> k >> d >> t;
  t = t * 2;
  double N = (k * 1.0 / d);
  long long n = (long long)ceil(N);
  long long somoyGese = n * d;
  long long rannaHoise = somoyGese + k;
  long long timeLagbe = (long long)(t / rannaHoise) * somoyGese;
  long long bakiAse = t % rannaHoise;
  double ans = timeLagbe;
  ans += (min(bakiAse, 2 * k) * 1.0 / 2);
  bakiAse -= min(bakiAse, 2 * k);
  ans += bakiAse;
  printf("%0.10lf\n", ans);
  return 0;
}
