#include <bits/stdc++.h>
using namespace std;
long long K, D, T, cyc;
double ans, roa, lst;
int main() {
  scanf("%lld%lld%lld", &K, &D, &T);
  cyc = ((K - 1) / D + 1) * D;
  roa = 0.5 * (cyc - K) + K;
  ans += (long long)(T / roa) * cyc;
  lst = T - (long long)(T / roa) * roa;
  if (lst < K)
    ans += lst;
  else
    ans = ans + K + 2.0 * (lst - K);
  printf("%.1lf\n", ans);
  return 0;
}
