#include <bits/stdc++.h>
using namespace std;
int main() {
  long long k, d, t;
  scanf("%lld%lld%lld", &k, &d, &t);
  long long T = ((k - 1) / d + 1) * d;
  double ans = 0;
  double one_T = (T - k) * 0.5 + k;
  ans += (long long)(t / one_T) * T;
  long long ht = t / one_T;
  double st = t - ht * one_T;
  if (st < k)
    ans += st;
  else
    ans = ans + k + (st - k) * 2;
  printf("%.1lf\n", ans);
  return 0;
}
