#include <bits/stdc++.h>
using namespace std;
inline int iin() {
  int x;
  scanf("%d", &x);
  return x;
}
inline long long int lin() {
  long long int x;
  scanf("%lld", &x);
  return x;
}
const long long int N = 1e6 + 85;
const long long int M = 1e3 + 85;
const long long int mod = 1e9 + 7;
const long long int pinf = LLONG_MAX;
const long long int minf = LLONG_MIN;
long double res;
int32_t main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  unsigned long long int k, d, t;
  cin >> k >> d >> t;
  t *= 2;
  unsigned long long int e = 2LL * k + (d - k), a = t / e, K = k / d;
  if (d >= k)
    res = a * d, t %= e;
  else {
    if (k % d) K++;
    e = 2LL * k + (K * d - k);
    a = t / e;
    res = a * d * K;
    t %= e;
  }
  if (t <= 2LL * k)
    res += (long double)t / 2;
  else
    t -= 2LL * k, res += (long double)(t + k);
  return cout << fixed << setprecision(14) << res, 0;
}
