#include <bits/stdc++.h>
using namespace std;
long double k, d, t, i, j;
long double a, b, c, e, first, g, h;
long double ans, ans1, ans2, check;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> k >> d >> t;
  a = ceil(k / d);
  b = a * d;
  c = b - k;
  e = 1 / (2 * t);
  e *= c;
  first = k / t;
  g = e + first;
  ans1 = floor(1.0 / g);
  ans = (ans1 * b);
  ans2 = ans1 * g;
  check = 1.0 - ans2;
  if (check <= 0.000000000) {
  } else if (check <= first) {
    ans += (((long double)check / first) * k);
    check = 0.0;
  } else if (check > first) {
    ans += k;
    check -= first;
  }
  if (check <= 0.000000000) {
  } else if (check <= e) {
    ans += (((long double)check / e) * c);
    check = 0.0;
  }
  cout << fixed << setprecision(11) << ans << endl;
  return 0;
}
