#include <bits/stdc++.h>
using namespace std;
int main() {
  double k, d, t;
  while (~scanf("%lf%lf%lf", &k, &d, &t)) {
    double kk =
        (long long)k % (long long)d == 0 ? 0 : d - (long long)k % (long long)d;
    double tt = k + kk / 2;
    double res = floor(t / tt) * (k + kk);
    t -= floor(t / tt) * tt;
    if (t > 0) {
      res += min(t, k);
      t -= k;
      if (t > 0) {
        res += t * 2;
      }
    }
    printf("%.1f\n", res);
  }
}
