#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9;
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
int main() {
  long long k, d, t;
  while (scanf("%lld%lld%lld", &k, &d, &t) != EOF) {
    if (k > t || k % d == 0) {
      printf("%.1f\n", 1.0 * t);
      continue;
    }
    long long m = (k / d) ? k / d + 1 : 1;
    double ans = 0, T = k * 1.0 + 1.0 * (m * d - k) / 2;
    long long num = (long long)1.0 * t / T;
    ans = m * d * num;
    double s = 1.0 * t - 1.0 * num * T;
    if (s <= k)
      ans += s;
    else
      ans += 1.0 * k + 1.0 * (s - k) * 2;
    printf("%.1lf\n", ans);
  }
  return 0;
}
