#include <bits/stdc++.h>
int main() {
  long long k, d, t;
  scanf("%lld %lld %lld", &k, &d, &t);
  auto cost = 2 * t;
  double duration = 0;
  auto m = (k + d - 1) / d;
  auto costdm = 2 * k + (m * d - k) % d;
  duration += cost / costdm * d * m;
  cost -= cost / costdm * costdm;
  if (cost <= 2 * k) {
    duration += cost / 2.0;
  } else {
    duration += k;
    cost -= 2 * k;
    duration += cost;
  }
  printf("%f\n", duration);
  return 0;
}
