#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long f = 1, x = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
long long t, k, d, ans;
int main() {
  cin >> k >> d >> t;
  long long x = k / d * d + (k % d != 0) * d;
  t *= 2ll;
  long long y = t / (2ll * k + (x - k));
  ans += y * x;
  t -= y * (2ll * k + (x - k));
  if (t >= 2ll * k) {
    ans += k + (t - 2ll * k);
    printf("%I64d.0\n", ans);
  } else {
    ans += t / 2;
    if (t % 2)
      printf("%I64d.5\n", ans);
    else
      printf("%I64d.0\n", ans);
  }
  return 0;
}
