#include <bits/stdc++.h>
using namespace std;
double t, k, d, start = 0, sum = 0;
int main() {
  scanf("%lf%lf%lf", &k, &d, &t);
  if ((long long)k % (long long)d == 0)
    printf("%.1f\n", t);
  else if (k >= t)
    printf("%.1f\n", t);
  else {
    if (k > d) {
      long long a = k / d;
      d *= a + 1;
    }
    long long x = (long long)t / (k + (d - k) / 2);
    start = (double)x * d;
    sum = (double)x * (k + (d - k) / 2);
    sum = t - sum;
    if (sum > k)
      start += k + (sum - k) * 2;
    else
      start += sum;
    printf("%.9f\n", start);
  }
  return 0;
}
