#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int k, d, t;
  cin >> k >> d >> t;
  long long int v = (k / d);
  if (k % d != 0) v++;
  v *= d;
  long long int z = ((2 * t) / (v + k));
  long double val = ((long double)2 * t - z * (v + k));
  val /= 2;
  long double ans = v * z;
  if (val <= k) {
    ans += val;
  } else {
    ans += (k + 2 * (val - k));
  }
  cout << setprecision(10) << fixed << ans;
  return 0;
}
