#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  long double k, d, n, totalmin = 0, totalpart = 0;
  cin >> k >> d >> n;
  long long p = k / d;
  cout << setprecision(12);
  if (d >= k) {
    totalmin = d;
    totalpart = 1.0 * k / n + 1.0 * (d - k) / (2.0 * n);
  } else if ((k - (p * d)) != 0) {
    totalmin = (p + 1.0) * d;
    totalpart = 1.0 * k / n + 1.0 * (d - (k - p * d)) / (2.0 * n);
  } else {
    cout << n << endl;
    return 0;
  }
  long double ans1;
  long double s = 1.0 / totalpart;
  long long s1 = s;
  s = 1.0 - 1.0 * s1 * totalpart;
  ans1 = 1.0 * s1 * totalmin;
  long double k1 = 1.0 * k / n;
  if (s <= k1) {
    ans1 += (s * n);
  } else {
    ans1 += (k);
    s -= k1;
    ans1 += (s * 2 * n);
  }
  cout << ans1 << endl;
  return 0;
}
