#include <bits/stdc++.h>
using namespace std;
long long n, m, i, j, k, ans, t, x, tmp, mx, curr, flag;
long long arr[1000005];
vector<long long> vec;
string s;
map<long long, long long> mpp;
int main() {
  long double k, d, t, ans = 0;
  cin >> k >> d >> t;
  if (k >= d) {
    long long a = k, b = d;
    if (k / d == a / b)
      d = k;
    else {
      d = ((long long)(k / d) + 1) * d;
    }
  }
  ans += (d) * (long long)(t / (k + (d - k) / 2));
  t -= ((long long)(t / (k + (d - k) / 2))) * (k + (d - k) / 2);
  if (t <= k) {
    ans += t;
  } else {
    ans += k;
    t -= k;
    ans += 2 * t;
  }
  cout << setprecision(20) << ans;
  return 0;
}
