#include <bits/stdc++.h>
using namespace std;
double Pi = acos(-1.0);
const int SIZE = 10000;
double k, d, t;
int main() {
  cin >> k >> d >> t;
  double x;
  x = ceil(k / d);
  double ans, time, y;
  time = k + (x * d - k) / 2;
  y = floor(t / time);
  ans = y * x * d;
  t -= time * y;
  if (t <= k) {
    ans += t;
  } else
    ans += k + (t - k) * 2;
  printf("%.1lf", ans);
  return 0;
}
