#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int k, d, t;
  cin >> k >> d >> t;
  long long int x = k / d;
  if (k % d) {
    x++;
  }
  long double W = 1;
  long double w1 = (long double)k / (long double)t;
  long double wt = (long double)(x * d + k) / (long double)(2 * t);
  long double w2 = wt - w1;
  long long int don = W / wt;
  long double ans = don;
  ans *= (long double)(x * d);
  W = W - don * wt;
  if (W >= w1) {
    ans += (long double)k;
    W -= ((long double)k / (long double)t);
    ans += ((W * (long double)t * (long double)2));
  } else {
    ans += (W * t);
  }
  cout << fixed << setprecision(18);
  ;
  cout << ans << "\n";
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int t, q;
  q = 1;
  for (t = 1; t <= q; t++) {
    solve();
  }
}
