#include <bits/stdc++.h>
using namespace std;
int main() {
  long long k, d;
  double t;
  cin >> k >> d >> t;
  long long time1 = k;
  long long time2 = 0;
  if (k % d > 0) {
    time2 = (k / d + 1) * d - k;
  }
  double each_sum = k + (double)time2 / 2;
  double res = 0;
  res += (long long)(t / each_sum) * (time1 + time2);
  t = t - (long long)(t / each_sum) * each_sum;
  if (t == 0) {
    printf("%.1f\n", res);
  } else {
    res += min(t, (double)k);
    t -= min(t, (double)k);
    res += t * 2;
    printf("%.1f\n", res);
  }
}
