#include <bits/stdc++.h>
using namespace std;
long long s;
long long k, d, t;
double go(double time) {
  s = time / d;
  double x = 0.5 * s * (d - k) / t + 1.0 * k / t * s;
  double c = time - s * d;
  double minn = min(1.0 * k, c);
  x += minn / t;
  c -= minn;
  x += c / (2 * t);
  return x;
}
int main() {
  cin >> k >> d >> t;
  if (k % d == 0) {
    return cout << t, 0;
  }
  double l = 0, r = 2.0 * 1e18 + 1;
  double m;
  d = ((long long)(k / d) + 1.0) * d;
  for (double i = 1; i < 1001; i++) {
    m = (l + r) / 2.0;
    if (go(m) >= 1) {
      r = m;
    } else
      l = m;
  }
  printf("%.15f", r);
}
