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