#include <bits/stdc++.h>
using namespace std;
const int maxn = 60;
int main() {
  long long k, t, d;
  while (~scanf("%lld%lld%lld", &k, &d, &t)) {
    t *= 2;
    k *= 2;
    long long tmp = k + ((d * 2 - (k % (d * 2))) % (d * 2)) / 2;
    long long temp = k + ((d * 2 - (k % (d * 2))) % (d * 2));
    double ans = 1.0 * (t / tmp) * temp;
    long long tmp1 = t % tmp;
    if (tmp1 > k) {
      ans += k;
      ans += (tmp1 - k) * 2;
    } else
      ans += t % tmp;
    printf("%.9f\n", 1.0 * ans / 2);
  }
  return 0;
}
