#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using LD = long double;
LL k, d, t;
int main() {
  cin >> k >> d >> t;
  if (d == k) {
    cout << t << endl;
  } else {
    t *= 2;
    if (k > d) {
      LL ti = (k + d - 1) / d, td = ti * d;
      d = td;
    }
    LL p = t / (2 * k + (d - k));
    LD ans = (long double)p * d;
    t -= p * (2 * k + (d - k));
    if (t <= 2 * k) {
      ans += (long double)t / 2;
    } else {
      ans += k;
      t -= 2 * k;
      ans += t;
    }
    printf("%.9Lf\n", ans);
  }
}
