#include <bits/stdc++.h>
using namespace std;
class numberTheory {
 public:
  numberTheory() {}
  pair<long long int, long long int> extendedEuclid(long long int a,
                                                    long long int b) {
    if (b == 0)
      return pair<long long int, long long int>(1LL, 0LL);
    else {
      pair<int, int> d = extendedEuclid(b, a % b);
      return pair<long long int, long long int>(d.second,
                                                d.first - d.second * (a / b));
    }
  }
  long long int modularInverse(long long int a, long long int n) {
    pair<long long int, long long int> ret = extendedEuclid(a, n);
    return ((ret.first % n) + n) % n;
  }
  long long int bigMod(long long int a, long long int n, long long int m) {
    long long int res = 1, x = a;
    while (n) {
      if (n & 1) {
        res = (res * x) % m;
      }
      x = (x * x) % m;
      n = n >> 1;
    }
    return res;
  }
};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  numberTheory nt;
  long long int n, a, b, k, hi, lo, sum, mul, ans, rt, bbya, bbyak, mod, i;
  string s;
  cin >> n >> a >> b >> k;
  cin >> s;
  mod = 1000000009;
  mul = nt.bigMod(a, n, mod);
  sum = 0;
  if (b == a) {
    for (i = 0; i < k; i++) {
      if (s[i] == '+') {
        sum += mul;
      } else {
        sum += (mod - mul);
      }
      while (sum < 0) sum = (sum + mod);
      sum %= mod;
    }
    rt = (n + 1) / k;
    cout << (sum * rt) % mod << endl;
    return 0;
  }
  bbya = (b * (nt.bigMod(a, mod - 2, mod))) % mod;
  bbyak = 1;
  for (i = 0; i < k; i++) {
    if (s[i] == '+') {
      sum += mul;
    } else {
      sum += (mod - mul);
    }
    while (sum < 0) sum = (sum + mod);
    sum %= mod;
    mul *= bbya;
    mul %= mod;
    bbyak *= bbya;
    bbyak %= mod;
  }
  rt = (n + 1) / k;
  if (bbyak == 1) {
    cout << (sum * rt) % mod << endl;
    return 0;
  }
  hi = nt.bigMod(bbyak, rt, mod) - 1;
  while (hi < 0) hi = (hi + mod);
  hi %= mod;
  lo = nt.modularInverse(bbyak - 1, mod);
  while (lo < 0) lo = (lo + mod);
  lo %= mod;
  if (hi == 0) {
    if (lo == 0) {
      cout << (sum * rt) % mod << endl;
      return 0;
    } else {
      cout << (sum * lo) % mod << endl;
      return 0;
    }
  }
  ans = (sum * hi) % mod;
  ans = (ans * lo) % mod;
  cout << ans << endl;
  return 0;
}

### Prompt

Develop a solution in Cpp to the problem described below:

You are given two integers a and b. Moreover, you are given a sequence s_0, s_1, ..., s_{n}. All values in s are integers 1 or -1. It's known that sequence is k-periodic and k divides n+1. In other words, for each k ≤ i ≤ n it's satisfied that s_{i} = s_{i - k}.

Find out the non-negative remainder of division of ∑ _{i=0}^{n} s_{i} a^{n - i} b^{i} by 10^{9} + 9.

Note that the modulo is unusual!

Input

The first line contains four integers n, a, b and k (1 ≤ n ≤ 10^{9}, 1 ≤ a, b ≤ 10^{9}, 1 ≤ k ≤ 10^{5}).

The second line contains a sequence of length k consisting of characters '+' and '-'. 

If the i-th character (0-indexed) is '+', then s_{i} = 1, otherwise s_{i} = -1.

Note that only the first k members of the sequence are given, the rest can be obtained using the periodicity property.

Output

Output a single integer — value of given expression modulo 10^{9} + 9.

Examples

Input

2 2 3 3
+-+


Output

7


Input

4 1 5 1
-


Output

999999228

Note

In the first example:

(∑ _{i=0}^{n} s_{i} a^{n - i} b^{i}) = 2^{2} 3^{0} - 2^{1} 3^{1} + 2^{0} 3^{2} = 7

In the second example:

(∑ _{i=0}^{n} s_{i} a^{n - i} b^{i}) = -1^{4} 5^{0} - 1^{3} 5^{1} - 1^{2} 5^{2} - 1^{1} 5^{3} - 1^{0} 5^{4} = -781 ≡ 999999228 \pmod{10^{9} + 9}.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
class numberTheory {
 public:
  numberTheory() {}
  pair<long long int, long long int> extendedEuclid(long long int a,
                                                    long long int b) {
    if (b == 0)
      return pair<long long int, long long int>(1LL, 0LL);
    else {
      pair<int, int> d = extendedEuclid(b, a % b);
      return pair<long long int, long long int>(d.second,
                                                d.first - d.second * (a / b));
    }
  }
  long long int modularInverse(long long int a, long long int n) {
    pair<long long int, long long int> ret = extendedEuclid(a, n);
    return ((ret.first % n) + n) % n;
  }
  long long int bigMod(long long int a, long long int n, long long int m) {
    long long int res = 1, x = a;
    while (n) {
      if (n & 1) {
        res = (res * x) % m;
      }
      x = (x * x) % m;
      n = n >> 1;
    }
    return res;
  }
};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  numberTheory nt;
  long long int n, a, b, k, hi, lo, sum, mul, ans, rt, bbya, bbyak, mod, i;
  string s;
  cin >> n >> a >> b >> k;
  cin >> s;
  mod = 1000000009;
  mul = nt.bigMod(a, n, mod);
  sum = 0;
  if (b == a) {
    for (i = 0; i < k; i++) {
      if (s[i] == '+') {
        sum += mul;
      } else {
        sum += (mod - mul);
      }
      while (sum < 0) sum = (sum + mod);
      sum %= mod;
    }
    rt = (n + 1) / k;
    cout << (sum * rt) % mod << endl;
    return 0;
  }
  bbya = (b * (nt.bigMod(a, mod - 2, mod))) % mod;
  bbyak = 1;
  for (i = 0; i < k; i++) {
    if (s[i] == '+') {
      sum += mul;
    } else {
      sum += (mod - mul);
    }
    while (sum < 0) sum = (sum + mod);
    sum %= mod;
    mul *= bbya;
    mul %= mod;
    bbyak *= bbya;
    bbyak %= mod;
  }
  rt = (n + 1) / k;
  if (bbyak == 1) {
    cout << (sum * rt) % mod << endl;
    return 0;
  }
  hi = nt.bigMod(bbyak, rt, mod) - 1;
  while (hi < 0) hi = (hi + mod);
  hi %= mod;
  lo = nt.modularInverse(bbyak - 1, mod);
  while (lo < 0) lo = (lo + mod);
  lo %= mod;
  if (hi == 0) {
    if (lo == 0) {
      cout << (sum * rt) % mod << endl;
      return 0;
    } else {
      cout << (sum * lo) % mod << endl;
      return 0;
    }
  }
  ans = (sum * hi) % mod;
  ans = (ans * lo) % mod;
  cout << ans << endl;
  return 0;
}

```