Problem: Julia is going to cook a chicken in the kitchen of her dormitory. To save energy, the stove in the kitchen automatically turns off after k minutes after turning on.

During cooking, Julia goes to the kitchen every d minutes and turns on the stove if it is turned off. While the cooker is turned off, it stays warm. The stove switches on and off instantly.

It is known that the chicken needs t minutes to be cooked on the stove, if it is turned on, and 2t minutes, if it is turned off. You need to find out, how much time will Julia have to cook the chicken, if it is considered that the chicken is cooked evenly, with constant speed when the stove is turned on and at a constant speed when it is turned off.

Input

The single line contains three integers k, d and t (1 ≤ k, d, t ≤ 1018).

Output

Print a single number, the total time of cooking in minutes. The relative or absolute error must not exceed 10 - 9.

Namely, let's assume that your answer is x and the answer of the jury is y. The checker program will consider your answer correct if <image>.

Examples

Input

3 2 6


Output

6.5


Input

4 2 20


Output

20.0

Note

In the first example, the chicken will be cooked for 3 minutes on the turned on stove, after this it will be cooked for <image>. Then the chicken will be cooked for one minute on a turned off stove, it will be cooked for <image>. Thus, after four minutes the chicken will be cooked for <image>. Before the fifth minute Julia will turn on the stove and after 2.5 minutes the chicken will be ready <image>.

In the second example, when the stove is turned off, Julia will immediately turn it on, so the stove will always be turned on and the chicken will be cooked in 20 minutes.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
long long fac[1000006];
inline long long exp(long long x, long long n) {
  long long r = 1;
  x = x % 1000000000000000000;
  while (n) {
    if (n % 2) r = (r * x) % 1000000000000000000;
    x = (x * x) % 1000000000000000000;
    n = n / 2;
  }
  return r;
}
inline long long mmi(long long a) {
  return exp(a, 1000000000000000000 - 2) % 1000000000000000000;
}
inline long long fact(long long n) {
  long long res = 1;
  for (long long i = 1; i < (n + 1); ++i) {
    res = (res * i) % 1000000000000000000;
  }
  return res;
}
inline void fact_a() {
  fac[0] = 1;
  fac[1] = 1;
  for (long long i = 1; i < (105); ++i) {
    fac[i] = (fac[i - 1] * i) % 1000000000000000000;
  }
}
inline long long inv_fact(long long n) {
  long long par = fac[n];
  long long res = mmi(par);
  return res;
}
inline long long comb(long long n, long long r) {
  if (n == r && r == 0) return 1;
  if (n < r) return 0;
  return ((fac[n] * inv_fact(r)) % 1000000000000000000 * inv_fact(n - r)) %
         1000000000000000000;
}
struct triplet {
  long long a, b, c;
};
bool operator<(const triplet &t1, const triplet &t2) {
  if (t1.a < t2.a) return true;
  if (t1.a == t2.a && t1.b < t2.b) return true;
  if (t1.a == t2.a && t1.b == t2.b && t1.c < t2.c) return true;
  return false;
}
pair<long long, pair<long long, long long> > ex_gcd(long long a, long long b) {
  if (b == 0) {
    return make_pair(a, make_pair(1, 0));
  }
  pair<long long, pair<long long, long long> > p = ex_gcd(b, a % b);
  long long gcd = p.first;
  long long x1 = p.second.first;
  long long y1 = p.second.second;
  long long x = y1;
  long long y = x1 - (a / b) * y1;
  return make_pair(gcd, make_pair(x, y));
}
long long prime[1000006];
long long spf_prime[1000006];
void sieve() {
  for (long long i = 2; i * i <= 1000000; i++)
    if (prime[i] == 0)
      for (long long j = i * i; j <= 1000000; j += i) prime[j] = 1;
}
void spf() {
  for (long long i = 2; i * i <= 1000000; i++)
    if (!spf_prime[i])
      for (long long j = i * i; j <= 1000000; j += i)
        if (!spf_prime[j]) spf_prime[j] = i;
  for (long long i = 2; i <= 1000000; i++)
    if (!spf_prime[i]) spf_prime[i] = i;
}
long long getparent_BIT(long long idx) { return idx - (idx & -idx); }
long long getnext_BIT(long long idx) { return idx + (idx & -idx); }
long long getsum_BIT(long long idx, long long BIT[], long long n) {
  long long sum = 0;
  while (idx > 0) {
    sum += BIT[idx];
    idx = getparent_BIT(idx);
  }
  return sum;
}
void update_BIT(long long idx, long long BIT[], long long val, long long n) {
  while (idx <= n) {
    BIT[idx] += val;
    idx = getnext_BIT(idx);
  }
}
void build_BIT(long long BIT[], long long a[], long long n) {
  for (long long i = 0; i < (n); ++i) {
    update_BIT(i, BIT, a[i], n);
  }
}
void comp_lps(string s, long long lps[], long long n) {
  long long i = 1, j = 0;
  while (i < n) {
    if (s[i] == s[j]) {
      lps[i++] = ++j;
    } else {
      if (j != 0)
        j = lps[j - 1];
      else
        lps[i++] = 0;
    }
  }
}
void dfs_l(long long u, vector<vector<long long> > &adj, long long status[]) {
  if (status[u] == 1) return;
  status[u] = 1;
  for (long long i = 0; i < (adj[u].size()); ++i) dfs_l(adj[u][i], adj, status);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long k, d;
  double t;
  cin >> k >> d >> t;
  long long rem = d - k % d;
  if (k % d == 0) rem = 0;
  double req = t;
  double time = 0;
  long long tot = k + rem;
  double val = k + (double)((double)rem / 2);
  long long num = 0;
  double g = 0;
  long long y = 2 * t;
  long long yy = (long long)(2 * val);
  num = y / yy;
  double left = t - (num)*val;
  time += tot * num;
  t = left;
  req = t;
  long long f = 0;
  while (req > 0) {
    if (f == 0) {
      if (k <= req) {
        time += k;
        req -= k;
      } else {
        time += req;
        req = 0;
      }
    } else {
      if (rem <= 2 * req) {
        time += rem;
        req -= (double)((double)rem / 2);
      } else {
        time += 2 * req;
        req = 0;
      }
    }
    f = (f + 1) % 2;
  }
  cout << fixed;
  cout << setprecision(2) << time << "\n";
}