#include <bits/stdc++.h>
int main() {
  long double K, D, T;
  std::cin >> K >> D >> T;
  long double val_on = (long double)1 / T;
  long double val_off = (long double)0.5 / T;
  long double cyc_len = D * ceil(K / D);
  long double cyc_val = val_on * K + val_off * (cyc_len - K);
  long double cyc_num = floor(1.0 / cyc_val);
  long double rem = 1 - cyc_num * cyc_val;
  long double time = cyc_num * cyc_len;
  if (rem <= K * val_on) {
    time += rem / val_on;
    rem = 0;
  } else {
    rem -= K * val_on;
    time += K;
  }
  time += rem / val_off;
  printf("%.09f\n", (double)time);
}
