#include <bits/stdc++.h>
using namespace std;
set<long long> st;
int main() {
  ios::sync_with_stdio(0);
  double k, d, t;
  cin >> k >> d >> t;
  long long kk = k, dd = d, tt = t;
  double temp = k / d;
  long long tmp = temp;
  if (temp != tmp) tmp++;
  temp = tmp;
  double curr = 0, ans = 0;
  tmp = t / (k + (temp * d - k) / 2.0);
  t -= tmp * ((k + (temp * d - k) / 2.0));
  ans += tmp * d * ((long long)temp);
  if (t >= k) {
    t -= k;
    ans += k;
  } else {
    ans += t;
    t = 0;
  }
  ans += 2 * t;
  printf("%.10lf", ans);
}
