#include <bits/stdc++.h>
using namespace std;
long double judge1(long long k, long long d, long long t) {
  long double ans;
  long double unit = k + (d - k) * 1.0 / 2;
  ans = floor(t / unit) * d;
  long double res = t * 1.0 - floor(t / unit) * unit;
  if (res <= k) {
    ans += res;
    return ans;
  } else {
    ans += k;
    res -= k;
  }
  ans += (res * 2);
  return ans;
}
long double judge2(long long k, long long d, long long t) {
  long double ans;
  ans = t;
  return ans;
}
long double judge3(long long k, long long d, long long t) {
  long double ans;
  long double unitt = (k / d + 1) * d * 1.0;
  long double unitw = k + (unitt - k) / 2.0;
  ans += floor(t / unitw) * unitt;
  long double res = t - floor(t / unitw) * unitw;
  if (fabs(res - k) <= 1e-9 || res < k) {
    ans += res;
    return ans;
  } else {
    ans += k;
    res -= k;
  }
  ans += (res * 2.0);
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  long long k, d, t;
  while (cin >> k >> d >> t) {
    long double ans;
    if (k < d)
      ans = judge1(k, d, t);
    else if (k % d == 0)
      ans = judge2(k, d, t);
    else
      ans = judge3(k, d, t);
    cout << fixed << setprecision(1) << ans << endl;
  }
  return 0;
}
