#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t d, k;
  double t;
  cin >> k >> d >> t;
  int64_t x = (d + k - 1) / d;
  int64_t period = x * d;
  double speed = (double)k + (double)(x * d - k) / (double)2;
  int64_t periods = floor(t / speed);
  t -= periods * speed;
  double ans = period * periods;
  if (t < k) {
    ans += t;
  } else {
    t -= k;
    ans += k;
    ans += t / 0.5;
  }
  cout << fixed << setprecision(9) << ans;
  return 0;
}
