#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
long double PI = 3.14159265358979323846;
using ll = long long;
const ll modo = 1000000000;
const ll inf = LONG_LONG_MAX;
const ll ms = (2e6) + 5;
ll peil(ll a, ll b) {
  if (a % b) return a / b + 1;
  return a / b;
}
long double help(long double mid, long double k, long double val, ll pp,
                 long double t) {
  ll tmp = mid;
  ll dd = tmp / pp;
  long double rem = mid - (dd * pp);
  long double ans = dd * val;
  long double hh = min(rem, k);
  ans += hh;
  rem -= hh;
  ans += (rem / 2);
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  cout << fixed << setprecision(10);
  ll k, d, t;
  cin >> k >> d >> t;
  long double kk = peil(k, d) * d;
  long double tt = k + ((kk - k) / 2);
  long double l = t;
  long double r = 2 * t;
  long double mid;
  long double ans = r;
  long double res;
  long double pp = 1 / (1e9);
  while ((r - l) > pp) {
    mid = (l + r) / 2;
    res = help(mid, k, tt, kk, t);
    if (res == t) {
      cout << mid;
      return 0;
    }
    if (res > t) {
      r = mid;
      ans = min(ans, mid);
    } else
      l = mid;
  }
  cout << ans;
  return 0;
}
