#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  i64 k, d, t, ant, span;
  cin >> k >> d >> t;
  t *= 2;
  if (k <= d)
    span = d;
  else
    span = k + (d - k % d) % d;
  ant = t / (k + span) * span * 2;
  t -= ant / 2 / span * (k + span);
  if (t <= 2 * k)
    ant += t;
  else
    ant += 2 * k + 2 * (t - 2 * k);
  cout << ant / 2 << '.' << (ant % 2) * 5 << endl;
  return 0;
}
