#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve() {
  ll k, d, t;
  cin >> k >> d >> t;
  d = ((k - 1) / d + 1) * d;
  t *= 2;
  ll now = k + d;
  ll k1 = t / now, rem = t % now;
  ll ans = d * k1, ans2 = 0;
  if (rem <= k * 2) {
    ans += rem / 2;
    ans2 = rem % 2;
  } else {
    ans += rem - k;
  }
  cout << ans << (ans2 ? ".5" : "") << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  while (t--) {
    solve();
  }
}
