#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
inline long long read() {
  long long s = 0, w = 1;
  char c = getchar();
  for (; !isdigit(c); c = getchar()) {
    if (c == '-') w = -1;
  }
  for (; isdigit(c); c = getchar()) {
    s = (s << 3) + (s << 1) + (c ^ 48);
  }
  return s * w;
}
int main() {
  long long k = read(), d = read(), t = read();
  long long x = ceil(k * 1.0 / d);
  long long one = 2 * k + (x * d - k);
  t <<= 1;
  long long T = floor(t * 1.0 / one);
  double ans = T * x * d;
  long long rest = t - T * one;
  if (2 * k >= rest) {
    ans += rest / 2.0;
  } else {
    ans += k;
    rest -= 2 * k;
    ans += rest;
  }
  printf("%.1f\n", ans);
  return 0;
}
