#include <bits/stdc++.h>
using namespace std;
const long long N = 1001 * 1001;
int32_t main() {
  ios::sync_with_stdio(0), cin.tie(0);
  long double k, d, t;
  cin >> k >> d >> t;
  long double x = 0;
  long long kk = k, dd = d;
  if (kk % dd != 0) x = dd - kk % dd;
  x /= 2;
  long long y = t / (k + x);
  long double ans = y * (k + 2 * x);
  long double tt = t - y * (k + x);
  cout << fixed << setprecision(10);
  if (tt <= k) return cout << ans + (tt) << endl, 0;
  tt -= k;
  cout << ans + k + (tt * 2) << endl;
}
