#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  long long d, k, t;
  cin >> k >> d >> t;
  if (d < k) {
    if (k % d == 0) {
      d = k;
    } else {
      d = (k / d + 1) * d;
    }
  }
  d *= 2;
  k *= 2;
  t *= 2;
  long long a = 0, b = LONG_LONG_MAX / 2, v;
  do {
    v = (a + b) / 2;
    long long c = v / d;
    long long tt = c * (2 * k + (d - k));
    long long p = v % d;
    if (p <= k) {
      tt += 2 * p;
    } else {
      tt += 2 * k + (p - k);
    }
    if (tt <= 2 * t) {
      a = v;
    } else {
      b = v;
    }
  } while (a + 1 < b);
  if (a % 2 == 0)
    cout << (a / 2);
  else
    cout << (a / 2) << ".5";
}
