#include <bits/stdc++.h>
using namespace std;
using LD = long double;
using LL = long long;
int main() {
  LL k, d, t;
  scanf("%lld%lld%lld", &k, &d, &t);
  t *= 2;
  LD ans = 0;
  if (d < k) {
    LL ti = (k + d - 1) / d;
    d = ti * d;
  }
  LL u = k + d, p = t / u;
  ans += d * p;
  t -= u * p;
  if (t <= 2 * k) {
    ans += t * 0.5;
    t = 0;
  } else {
    ans += k;
    t -= 2 * k;
  }
  ans += t;
  printf("%.12Lf\n", ans);
}
