#include <bits/stdc++.h>
using namespace std;
namespace {
void Solve(long long) {
  long long k, d, t;
  if (not(cin >> k >> d >> t)) return;
  const long long per = ((k + d - 1) / d) * d;
  long double low = 1, hig = 3 * t;
  for (long long its = 0, __its = 100; its < __its; ++its) {
    const long double mid = (low + hig) / 2.0;
    const long double on =
        floor(mid / per) * k + min((long double)k, fmod(mid, per));
    const long double off = mid - on;
    if (2.0 * on + off >= 2.0 * t) {
      hig = mid;
    } else {
      low = mid;
    }
  }
  cout << fixed << setprecision(10) << hig << endl;
}
void Init() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
}
}  // namespace
int main() {
  Init();
  long long tests = 100;
  for (long long test = 1, __test = tests + 1; test < __test; ++test)
    Solve(test);
  return 0;
}
