#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, i, j, k, d, x, y, tt, t, z;
  double ans;
  scanf("%I64d%I64d%I64d", &k, &d, &t);
  t *= 2;
  x = ((k - 1) / d + 1) * d;
  y = x + k;
  z = t / y;
  tt = z * y;
  t -= tt;
  if (t <= k * 2) {
    ans = t;
    ans /= 2;
  } else {
    ans = t - k;
  }
  ans += (double)z * x;
  printf("%.11f\n", ans);
  return 0;
}
