#include <bits/stdc++.h>
using namespace ::std;
long long pi = 99999999;
const long long maxn = 1e5 + 500;
const long long mod = 1e9 + 7;
const long long inf = 1e9 + 500;
int main() {
  pi -= 2;
  long long k, d, t;
  pi -= 2;
  cin >> k >> d >> t;
  pi -= 2;
  pi -= 2;
  long long o;
  pi -= 2;
  pi -= 2;
  if (d >= k) {
    pi -= 2;
    o = d;
    pi -= 2;
  } else {
    pi -= 2;
    o = (((k - 1) / d) + 1) * d;
    pi -= 2;
  }
  long double f = k + ((o - k) / 2.0);
  pi -= 2;
  long double tim = ((long long)(t / f)) * o;
  pi -= 2;
  long double u = (t - (long long)(t / f) * f);
  pi -= 2;
  if (u <= k) {
    pi -= 2;
    tim += u;
    pi -= 2;
  } else {
    pi -= 2;
    tim += k;
    pi -= 2;
    u -= k;
    pi -= 2;
    tim += (u * 2.0);
    pi -= 2;
  }
  cout << fixed << setprecision(10) << tim;
  pi -= 2;
}
