#include <bits/stdc++.h>
using namespace std;
void __print(long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  long long f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
const long long gf = 1e6 + 9;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(0);
  long long k, d, t;
  cin >> k >> d >> t;
  cout << fixed << setprecision(10);
  long double l = 1.0;
  long double r = (1e9 + 5) * 1.00;
  long long x, y;
  if (d > k) {
    x = k;
    y = d;
  } else {
    long long var = ((k + d - 1) / d) * d;
    ;
    y = var;
    x = k;
  };
  long long lol = (2.0 * t) / (y + x);
  long double ans = 0.0;
  ans += lol * (y + 0.0) + 0.0;
  long double var = 1.0;
  var -= lol * ((y + x) / (2.0 * t));
  ;
  if ((x + 0.0) / t <= var) {
    var -= (x + 0.0) / t;
    ans += x + 0.0;
    ans += var * 2.0 * t;
  } else {
    ans += var * (t + 0.0) + 0.0;
  }
  cout << ans << '\n';
  return 0;
}
