#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b, c, temp = 1;
  cin >> a >> b >> c;
  if (b <= a) {
    temp = a / b;
    if (a % b != 0) temp = temp + 1;
  }
  double sum = 0;
  long long int on = a;
  long long int off = (b * temp - on);
  long long int total = on + off;
  double time = on + 0.5 * off;
  long long int q = c / time;
  double left = c - time * q;
  if (left <= on) {
    sum = (int)left;
    left = left - sum;
    sum += left;
  } else {
    sum = on;
    left = left - on;
    sum += (left / 0.5);
  }
  sum += q * total;
  cout << setprecision(30) << sum;
  return 0;
}
