#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
const int N = 1e3 + 10;
const int M = 2e6 + 10;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const int mod = 1e9 + 7;
const int mod2 = 998244353;
const int mod3 = 1e9 + 9;
const int hash1 = 131;
const int hash2 = 13331;
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  long long k, d, t;
  cin >> k >> d >> t;
  t *= 2;
  long long times = k / d;
  long long rem = k % d;
  long long T = (times + (rem ? 1 : 0)) * d;
  long long val1 = 2 * k;
  long long val2 = rem ? (d - rem) : 0;
  double ans = t / (val1 + val2) * T;
  t = t % (val1 + val2);
  if (t) {
    if (t <= 2 * k) {
      ans += t / 2.0;
    } else {
      ans += k;
      t -= 2 * k;
      ans += t;
    }
  }
  cout << fixed << setprecision(9) << ans << endl;
  return 0;
}
