#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x;
  scanf("%I64d", &x);
  return x;
}
const long double eps = 1e-15;
int main() {
  long long k = read(), d = read(), t = read();
  long double t1 = 1.0 / (1.0 * t), t2 = 1 / (2.0 * t);
  if (k % d == 0) {
    cout << t;
  } else {
    long double wk1 = t1 * 1.0 * k, wk2 = ((k / d + 1) * d - k) * t2;
    long long num = 1.0 / (wk1 + wk2), res = ((k / d + 1) * d) * num;
    if (1 - num * (wk1 + wk2) <= wk1)
      cout << std::setprecision(20)
           << 1.0 * res + (1.0 - num * 1.0 * (wk1 + wk2)) * 1.0 / t1;
    else
      cout << std::setprecision(20)
           << 1.0 * res + k * 1.0 + (1.0 - num * 1.0 * (wk1 + wk2) - wk1) / t2;
  }
}
