#include <bits/stdc++.h>
using namespace std;
long double k, d, t, ans;
int main() {
  cin >> k >> d >> t;
  long double T = ceil(k / d) * d;
  long double Tt = k + (T - k) / 2;
  ans += floor(t / Tt) * T;
  long double rest = t - floor(t / Tt) * Tt;
  if (rest <= k) {
    printf("%.1Lf", ans + rest);
  } else {
    ans += k;
    rest -= k;
    printf("%.1Lf", ans + rest * 2);
  }
}
