#include <bits/stdc++.h>
using namespace std;
long long a, b, c, ans;
long long m, n;
int judge(long double x) {
  long long k = (long long)x / ans;
  long double f = m * k;
  long double g = n * k;
  x = x - k * ans;
  if (x <= m) {
    f += x;
  } else {
    f += m;
    g = g + x - m;
  }
  if (f * 2 + g >= c * 2) {
    return 1;
  } else {
    return 0;
  }
}
int main() {
  cin >> a >> b >> c;
  ans = b * ((a + b - 1) / b);
  m = (a / b) * b + (a % b);
  n = ans - m;
  long double l = 0.0;
  long double r = 2e18;
  for (int i = 0; i < 200; i++) {
    long double m = (l + r) / 2;
    if (judge(m)) {
      r = m;
    } else {
      l = m;
    }
  }
  cout << setprecision(12) << std::fixed << l << endl;
}
