#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long k, d, t;
  cin >> k >> d >> t;
  if (k % d == 0) {
    printf("%lld\n", t);
  } else {
    unsigned long long num = k / d;
    unsigned long long num1 = k % d;
    unsigned long long t1 = (num + 1) * d;
    double onezhi = num * d + (d - num1) * 0.5 + num1;
    unsigned long long ans1 = t / onezhi;
    double t2 = t - onezhi * ans1;
    double ans;
    if (t2 <= k) {
      ans = t2 + t1 * ans1;
    } else {
      ans = t1 * ans1 + k + (t2 - k) * 2;
    }
    printf("%.9lf\n", ans);
  }
}
