#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool fs(T &x) {
  int c = getchar();
  int sgn = 1;
  while (~c && c < '0' || c > '9') {
    if (c == '-') sgn = -1;
    c = getchar();
  }
  for (x = 0; ~c && '0' <= c && c <= '9'; c = getchar()) x = x * 10 + c - '0';
  x *= sgn;
  return ~c;
}
int main() {
  long long int k, d, t, one, zero;
  long long int temp;
  double tot = 0;
  scanf("%lld", &k);
  scanf("%lld", &d);
  scanf("%lld", &t);
  if (t <= k) {
    tot = t;
    printf("%.10f\n", tot);
    return 0;
  }
  if (k % d == 0) {
    tot = t;
    printf("%.10f\n", tot);
    return 0;
  }
  if (k > d) {
    temp = k / d;
    temp += 1;
    temp = (temp * d);
    one = k;
    zero = temp - k;
    tot = (long long int)((long long int)(2 * t) /
                          (long long int)((2 * one) + zero));
    tot = tot * temp;
    temp = (2 * t) % ((2 * one) + zero);
    if (temp <= (2 * one)) {
      tot += (((double)temp) / 2.0);
    } else {
      tot += one;
      temp -= (2 * one);
      tot += temp;
    }
    printf("%.10f\n", tot);
  } else {
    temp = d;
    one = k;
    zero = d - k;
    tot = (long long int)((long long int)(2 * t) /
                          (long long int)((2 * one) + zero));
    tot = tot * temp;
    temp = (2 * t) % ((2 * one) + zero);
    if (temp <= (2 * one)) {
      tot += (((double)temp) / 2.0);
    } else {
      tot += one;
      temp -= (2 * one);
      tot += temp;
    }
    printf("%.10f\n", tot);
  }
  return 0;
}
