#include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-10;
long long k, d, t;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> k >> d >> t;
  d *= (k + d - 1) / d;
  long double L = 0;
  long double R = 2e18;
  for (long long i = 0; i < 1000; i++) {
    long double M = (L + R) / 2;
    long double r = M - d * (long long)(M / d);
    long double x = (long long)(M / d) * k + min(r, (long double)k);
    long double y = M - x;
    long double z = x / t + y / (2 * t);
    if (z >= 1)
      R = M;
    else
      L = M;
  }
  cout << setprecision(20) << L;
}
