#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long k, d, t, cycle, subTimes;
  unsigned long long ans = 0, velocity, t2;
  scanf("%lld%lld%lld", &k, &d, &t);
  k *= 2;
  d *= 2;
  t *= 2;
  subTimes = (k + d - 1) / d;
  cycle = subTimes * d;
  velocity = k + (cycle - k) / 2;
  ans = t / velocity * cycle;
  t2 = t - t / velocity * velocity;
  if (t2 <= k) {
    ans += t2;
  } else {
    ans += k + 2 * (t2 - k);
  }
  printf("%.1lf\n", ans / 2.);
  return 0;
}
