#include <bits/stdc++.h>
using namespace std;
const unsigned long long INF = (unsigned long long)8e18 + 5;
unsigned long long k, d, t;
unsigned long long mul(unsigned long long a, unsigned long long b) {
  if (INF / b > a) return a * b;
  return INF;
}
unsigned long long sm(unsigned long long a, unsigned long long b) {
  if (INF - b > a) return a + b;
  return INF;
}
unsigned long long get(unsigned long long mid) {
  unsigned long long pr = k + (k % d == 0ull ? 0ull : d - k % d);
  unsigned long long x = mid / pr;
  unsigned long long tot = mul(x, (k * 2 + (pr - k)));
  if (tot == INF) return tot;
  unsigned long long rem = mid % pr;
  tot = sm(tot, min(k, rem) * 2ull);
  if (tot == INF) return tot;
  if (rem > k) tot = sm(tot, rem - k);
  return tot;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> k >> d >> t, t *= 2, k *= 2, d *= 2;
  unsigned long long lo = 0, hi = (unsigned long long)4e18 + 3;
  unsigned long long temp = hi + hi >> 1;
  while (hi - lo > 1) {
    unsigned long long mid = hi + lo >> 1;
    if (get(mid) >= t * 2ull)
      hi = mid;
    else
      lo = mid;
  }
  cout << hi / 2;
  if (hi & 1) cout << ".5";
  cout << "\n";
  return 0;
}
