#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
string s;
long long n, m;
int main() {
  ios::sync_with_stdio(0);
  long long a, b, c;
  cin >> a >> b >> c;
  c *= 2ll;
  long long k = a;
  long long p = ((a - 1) / b + 1) * b - k;
  long long pas = 0;
  pas += c / (2ll * k + p) * (k + p);
  c = c % (2ll * k + p);
  if (c <= 2ll * k) {
    if (c & 1ll)
      cout << pas + c / 2ll << ".5";
    else
      cout << pas + c / 2ll;
  } else {
    pas += k;
    c -= 2ll * k;
    cout << pas + c;
  }
}
