#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
constexpr int32_t mod = 1e9 + 7, m1 = 1e9 + 123, m2 = 1e9 + 321;
static const int base = uniform_int_distribution<int>(300, (int)1e9 + 122)(rng);
static inline int add(int a, int b, int Mod) {
  return ((long long)a + b) % Mod;
}
static inline int sub(int a, int b, int Mod) {
  return (((long long)a - b) % Mod + Mod) % Mod;
}
static inline int mul(int a, int b, int Mod) { return 1ll * a * b % Mod; }
long long k, d, t;
long double check(long long x) {
  long double ret = k;
  long long cnt = 0, m = k + d - (k % d == 0 ? d : k % d);
  if (x <= k) return x;
  cnt += ((x - k) / m) * k;
  ret += cnt;
  if ((x - k) % m) {
    long long mn =
        min(k, (x - k) % m - min((x - k) % m, (d - (k % d == 0 ? d : k % d))));
    ret += mn;
    cnt += mn;
  }
  cnt += k;
  ret += (long double)(x - cnt) / 2;
  return ret;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  cin >> k >> d >> t;
  long long st = 0, en = 2 * t + 1, m;
  while (1) {
    m = (st + en) / 2;
    if (st == m) break;
    if (check(m) > t)
      en = m;
    else
      st = m;
  }
  cout << fixed;
  if (check(m) == t)
    cout << m << '\n';
  else if (check(m) > t)
    cout << (long double)m - 0.5 << '\n';
  else
    cout << (long double)m + 0.5 << '\n';
  return 0;
}
