#include <bits/stdc++.h>
using namespace std;
const int N = (int)3e6 + 10;
const int M = (int)2e6 + 10;
const long long LINF = (long long)1e18;
const int INF = (int)1e9 + 7;
const int ALPHA = 26;
const int mod = INF + 2;
const double PI = 3.14159265359;
const long double EPS = (long double)1e-12;
const int nx[4] = {0, 0, -1, 1};
const int ny[4] = {1, -1, 0, 0};
int main() {
  long long k, d, t;
  cin >> k >> d >> t;
  long long delta = ((k + d - 1) / d) * d;
  long long cold = delta - k;
  long long hot = k;
  long long ans;
  t *= 2;
  ans = t / (cold + 2 * hot);
  t -= ans * (cold + 2 * hot);
  if (hot * 2 >= t) {
    cout << fixed << setprecision(1) << ans * delta + t * 1.0 / 2;
  } else {
    cout << fixed << setprecision(1) << ans * delta + hot + (t - hot * 2);
  }
  return 0;
}
