#include <bits/stdc++.h>
using namespace std;
double qiuyu(double a, double b) { return a - b * (long long)(a / b + 1e-9); }
int main() {
  long long k, d, t;
  long long temp;
  cin >> k >> d >> t;
  if (k >= d) {
    if (k % d == 0) {
      printf("%.1f", t * 1.0);
      return 0;
    } else
      temp = (long long)((k / d + 1) * d + 1e-9);
  } else
    temp = d;
  double yushu = qiuyu(t * 1.0, k + (temp - k) / 2.0);
  if (yushu <= k + 1e-9)
    printf("%.1f",
           (long long)(t * 1.0 / (k + (temp - k) * 1.0 / 2) + 1e-9) * temp +
               yushu);
  else
    printf("%.1f",
           (long long)(t * 1.0 / (k + (temp - k) * 1.0 / 2) + 1e-9) * temp + k +
               2 * (yushu - k));
}
