#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int k, d, t;
  cin >> k >> d >> t;
  t *= 2;
  long long int answer = 0;
  long long int b = (k + d - 1) / d * d;
  long long int a = b + k;
  answer += t / a * b;
  t -= t / a * a;
  if (t > 2 * k) {
    t -= 2 * k;
    answer += k;
    answer += t;
    cout << answer;
  } else {
    answer += t / 2;
    cout << answer;
    if (t % 2) cout << ".5";
  }
  return 0;
}
