#include <bits/stdc++.h>
using namespace std;
const long long int maxn = 2e5 + 5;
const long long int inf = 1e9;
const long double PI = acos(-1);
void yes() { cout << "YES"; }
void no() { cout << "NO"; }
long long int pmod(long long int a, long long int mod = 1000000007) {
  return ((a) % mod + mod) % mod;
}
long long int cel(long long int x1, long long int y1) {
  if ((x1) <= 0) {
    return (x1) / (y1);
  }
  return (((x1) / (y1)) + (((x1) % (y1)) != 0));
}
bool isprime(long long int n) {
  for (long long int i = 2; i * i <= n; i++)
    if (n % i == 0) return false;
  return true;
}
long long int gcd(long long int a, long long int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long int lcm(long long int a, long long int b) {
  return ((a / gcd(a, b)) * b);
}
long long bp(long long a, long long b) {
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a;
    a = a * a;
    b >>= 1;
  }
  return res;
}
long long bpm(long long a, long long b, long long m = 1000000007) {
  if (a >= m) a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res *= a;
    if (res >= m) res %= m;
    a *= a;
    if (a >= m) a %= m;
    b >>= 1;
  }
  if (res >= m) res %= m;
  return res;
}
string vow = "aeiou";
const int dr4[] = {-1, 0, 1, 0};
const int dc4[] = {0, 1, 0, -1};
const int drk[] = {-1, 0, 1, 0, -1, -1, 1, 1};
const int dck[] = {0, 1, 0, -1, -1, 1, -1, 1};
const int drh[] = {-2, -2, -1, -1, 1, 1, 2, 2};
const int dch[] = {1, -1, 2, -2, 2, -2, 1, -1};
const int mod = 1e9 + 9;
long long int inv(long long int x) { return bpm(x, mod - 2, mod); }
long long int gpsum(long long int r, long long int p) {
  long long int num = (bpm(r, p, mod) - 1) % mod;
  long long int den = (r - 1) % mod;
  long long int res = num;
  res = (res * inv(den)) % mod;
  res = (res + mod) % mod;
  return res;
}
void solve(int tc) {
  long long int n, a, b, k;
  cin >> n >> a >> b >> k;
  string s;
  cin >> s;
  long long int val = 0;
  for (long long int i = 0; i < k; i++) {
    long long int temp = ((bpm(a, n - i, mod) * bpm(b, i, mod)) % mod);
    if (s[i] == '-') {
      temp = -temp;
      temp %= mod;
    }
    val += temp;
    val %= mod;
  }
  long long int p = (n + 1) / k;
  long long int base = (inv(a) * b) % mod;
  long long int r = bpm(base, k, mod);
  long long int ans;
  if (r == 1) {
    ans = (p * val) % mod;
  } else
    ans = (gpsum(r, p) * val) % mod;
  ans = (ans + mod) % mod;
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  cout.tie();
  ;
  int t = 1;
  for (long long int i = 1; i <= t; i++) {
    solve(i);
    cout << "\n";
  }
  return 0;
}

### Prompt

Please provide a Cpp coded solution 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;
const long long int maxn = 2e5 + 5;
const long long int inf = 1e9;
const long double PI = acos(-1);
void yes() { cout << "YES"; }
void no() { cout << "NO"; }
long long int pmod(long long int a, long long int mod = 1000000007) {
  return ((a) % mod + mod) % mod;
}
long long int cel(long long int x1, long long int y1) {
  if ((x1) <= 0) {
    return (x1) / (y1);
  }
  return (((x1) / (y1)) + (((x1) % (y1)) != 0));
}
bool isprime(long long int n) {
  for (long long int i = 2; i * i <= n; i++)
    if (n % i == 0) return false;
  return true;
}
long long int gcd(long long int a, long long int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long int lcm(long long int a, long long int b) {
  return ((a / gcd(a, b)) * b);
}
long long bp(long long a, long long b) {
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a;
    a = a * a;
    b >>= 1;
  }
  return res;
}
long long bpm(long long a, long long b, long long m = 1000000007) {
  if (a >= m) a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res *= a;
    if (res >= m) res %= m;
    a *= a;
    if (a >= m) a %= m;
    b >>= 1;
  }
  if (res >= m) res %= m;
  return res;
}
string vow = "aeiou";
const int dr4[] = {-1, 0, 1, 0};
const int dc4[] = {0, 1, 0, -1};
const int drk[] = {-1, 0, 1, 0, -1, -1, 1, 1};
const int dck[] = {0, 1, 0, -1, -1, 1, -1, 1};
const int drh[] = {-2, -2, -1, -1, 1, 1, 2, 2};
const int dch[] = {1, -1, 2, -2, 2, -2, 1, -1};
const int mod = 1e9 + 9;
long long int inv(long long int x) { return bpm(x, mod - 2, mod); }
long long int gpsum(long long int r, long long int p) {
  long long int num = (bpm(r, p, mod) - 1) % mod;
  long long int den = (r - 1) % mod;
  long long int res = num;
  res = (res * inv(den)) % mod;
  res = (res + mod) % mod;
  return res;
}
void solve(int tc) {
  long long int n, a, b, k;
  cin >> n >> a >> b >> k;
  string s;
  cin >> s;
  long long int val = 0;
  for (long long int i = 0; i < k; i++) {
    long long int temp = ((bpm(a, n - i, mod) * bpm(b, i, mod)) % mod);
    if (s[i] == '-') {
      temp = -temp;
      temp %= mod;
    }
    val += temp;
    val %= mod;
  }
  long long int p = (n + 1) / k;
  long long int base = (inv(a) * b) % mod;
  long long int r = bpm(base, k, mod);
  long long int ans;
  if (r == 1) {
    ans = (p * val) % mod;
  } else
    ans = (gpsum(r, p) * val) % mod;
  ans = (ans + mod) % mod;
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  cout.tie();
  ;
  int t = 1;
  for (long long int i = 1; i <= t; i++) {
    solve(i);
    cout << "\n";
  }
  return 0;
}

```