#include <bits/stdc++.h>
using namespace std;
double solve(long long int k, long long int d, long long int t) {
  long long int i, j, stopage;
  double l, m, res, fastcook, cookeavg, first = 0, last = 2 * t, mid;
  l = k;
  m = d;
  if (k < d) {
    stopage = d;
    fastcook = k;
  } else {
    stopage = ceil(l / m) * d;
    fastcook = k;
  }
  double avgcook = fastcook + (stopage - fastcook) / 2;
  int tot = 0;
  while (tot <= 300) {
    tot++;
    mid = (first + last) / 2;
    long long int averagetime, intmid;
    double extratime, extracook, avgtimecook, total, g = 1, h = 0;
    intmid = mid;
    averagetime = (intmid / stopage) * stopage;
    avgtimecook = (intmid / stopage) * avgcook;
    extratime = mid - averagetime;
    total = avgtimecook + min(fastcook, extratime) +
            max(h, extratime - fastcook) / 2;
    ;
    if (total > t) {
      last = mid;
    } else
      first = mid;
  }
  return mid;
}
int main() {
  long long int n, k, d, t;
  double res;
  scanf("%lld %lld %lld", &k, &d, &t);
  printf("%.10lf\n", solve(k, d, t));
}
