#include <bits/stdc++.h>
using namespace std;
string s;
int n, m;
int parA[101010], imparA[101010], parB[101010], imparB[101010], inter[101010];
char lst;
pair<int, int> dp[101010];
pair<int, int> acc[101010];
void build() {
  for (int i = 0; i < (int)s.size(); i++) {
    if (s[i] == 'a') {
      if (i % 2 == 0) {
        parA[i] = 1;
      } else {
        imparA[i] = 1;
      }
    } else if (s[i] == 'b') {
      if (i % 2 == 0) {
        parB[i] = 1;
      } else {
        imparB[i] = 1;
      }
    } else {
      inter[i] = 1;
    }
    parA[i] += (i ? parA[i - 1] : 0);
    imparA[i] += (i ? imparA[i - 1] : 0);
    parB[i] += (i ? parB[i - 1] : 0);
    imparB[i] += (i ? imparB[i - 1] : 0);
    inter[i] += (i ? inter[i - 1] : 0);
  }
}
int getAPar(int l, int r) { return parA[r] - (l ? parA[l - 1] : 0); }
int getAImpar(int l, int r) { return imparA[r] - (l ? imparA[l - 1] : 0); }
int getBPar(int l, int r) { return parB[r] - (l ? parB[l - 1] : 0); }
int getBImpar(int l, int r) { return imparB[r] - (l ? imparB[l - 1] : 0); }
int getInter(int l, int r) { return inter[r] - (l ? inter[l - 1] : 0); }
bool can(int pos) {
  int aFora, bFora;
  if (pos % 2 == 0) {
    if (lst == 'a') {
      aFora = getAImpar(pos - m + 1, pos);
      if (aFora > 0) return false;
      bFora = getBPar(pos - m + 1, pos);
      if (bFora > 0) return false;
    } else {
      aFora = getAPar(pos - m + 1, pos);
      if (aFora > 0) return false;
      bFora = getBImpar(pos - m + 1, pos);
      if (bFora > 0) return false;
    }
  } else {
    if (lst == 'a') {
      aFora = getAPar(pos - m + 1, pos);
      if (aFora > 0) return false;
      bFora = getBImpar(pos - m + 1, pos);
      if (bFora > 0) return false;
    } else {
      aFora = getAImpar(pos - m + 1, pos);
      if (aFora > 0) return false;
      bFora = getBPar(pos - m + 1, pos);
      if (bFora > 0) return false;
    }
  }
  return true;
}
int getCost(int pos) { return getInter(pos - m + 1, pos); }
pair<int, int> _max(pair<int, int> a, pair<int, int> b) {
  if (a.first == b.first) return make_pair(a.first, min(a.second, b.second));
  if (a.first < b.first) return b;
  return a;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  cin >> s;
  cin >> m;
  if (m % 2)
    lst = 'a';
  else
    lst = 'b';
  build();
  for (int i = 0; i < m - 1; i++) {
    dp[i] = make_pair(0, 0);
  }
  for (int i = m - 1; i < n; i++) {
    if (can(i)) {
      dp[i] = make_pair(acc[i - m].first + 1, acc[i - m].second + getCost(i));
    } else {
      dp[i] = make_pair(0, 0);
    }
    acc[i] = _max((i ? acc[i - 1] : make_pair(0, 0)), dp[i]);
  }
  cout << acc[n - 1].second << "\n";
  return 0;
}

### Prompt

Please formulate a CPP solution to the following problem:

Vasya wrote down two strings s of length n and t of length m consisting of small English letters 'a' and 'b'. What is more, he knows that string t has a form "abab...", namely there are letters 'a' on odd positions and letters 'b' on even positions.

Suddenly in the morning, Vasya found that somebody spoiled his string. Some letters of the string s were replaced by character '?'.

Let's call a sequence of positions i, i + 1, ..., i + m - 1 as occurrence of string t in s, if 1 ≤ i ≤ n - m + 1 and t1 = si, t2 = si + 1, ..., tm = si + m - 1.

The boy defines the beauty of the string s as maximum number of disjoint occurrences of string t in s. Vasya can replace some letters '?' with 'a' or 'b' (letters on different positions can be replaced with different letter). Vasya wants to make some replacements in such a way that beauty of string s is maximum possible. From all such options, he wants to choose one with the minimum number of replacements. Find the number of replacements he should make.

Input

The first line contains a single integer n (1 ≤ n ≤ 105) — the length of s.

The second line contains the string s of length n. It contains small English letters 'a', 'b' and characters '?' only.

The third line contains a single integer m (1 ≤ m ≤ 105) — the length of t. The string t contains letters 'a' on odd positions and 'b' on even positions.

Output

Print the only integer — the minimum number of replacements Vasya has to perform to make the beauty of string s the maximum possible.

Examples

Input

5
bb?a?
1


Output

2


Input

9
ab??ab???
3


Output

2

Note

In the first sample string t has a form 'a'. The only optimal option is to replace all characters '?' by 'a'.

In the second sample using two replacements we can make string equal to "aba?aba??". It is impossible to get more than two occurrences.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
string s;
int n, m;
int parA[101010], imparA[101010], parB[101010], imparB[101010], inter[101010];
char lst;
pair<int, int> dp[101010];
pair<int, int> acc[101010];
void build() {
  for (int i = 0; i < (int)s.size(); i++) {
    if (s[i] == 'a') {
      if (i % 2 == 0) {
        parA[i] = 1;
      } else {
        imparA[i] = 1;
      }
    } else if (s[i] == 'b') {
      if (i % 2 == 0) {
        parB[i] = 1;
      } else {
        imparB[i] = 1;
      }
    } else {
      inter[i] = 1;
    }
    parA[i] += (i ? parA[i - 1] : 0);
    imparA[i] += (i ? imparA[i - 1] : 0);
    parB[i] += (i ? parB[i - 1] : 0);
    imparB[i] += (i ? imparB[i - 1] : 0);
    inter[i] += (i ? inter[i - 1] : 0);
  }
}
int getAPar(int l, int r) { return parA[r] - (l ? parA[l - 1] : 0); }
int getAImpar(int l, int r) { return imparA[r] - (l ? imparA[l - 1] : 0); }
int getBPar(int l, int r) { return parB[r] - (l ? parB[l - 1] : 0); }
int getBImpar(int l, int r) { return imparB[r] - (l ? imparB[l - 1] : 0); }
int getInter(int l, int r) { return inter[r] - (l ? inter[l - 1] : 0); }
bool can(int pos) {
  int aFora, bFora;
  if (pos % 2 == 0) {
    if (lst == 'a') {
      aFora = getAImpar(pos - m + 1, pos);
      if (aFora > 0) return false;
      bFora = getBPar(pos - m + 1, pos);
      if (bFora > 0) return false;
    } else {
      aFora = getAPar(pos - m + 1, pos);
      if (aFora > 0) return false;
      bFora = getBImpar(pos - m + 1, pos);
      if (bFora > 0) return false;
    }
  } else {
    if (lst == 'a') {
      aFora = getAPar(pos - m + 1, pos);
      if (aFora > 0) return false;
      bFora = getBImpar(pos - m + 1, pos);
      if (bFora > 0) return false;
    } else {
      aFora = getAImpar(pos - m + 1, pos);
      if (aFora > 0) return false;
      bFora = getBPar(pos - m + 1, pos);
      if (bFora > 0) return false;
    }
  }
  return true;
}
int getCost(int pos) { return getInter(pos - m + 1, pos); }
pair<int, int> _max(pair<int, int> a, pair<int, int> b) {
  if (a.first == b.first) return make_pair(a.first, min(a.second, b.second));
  if (a.first < b.first) return b;
  return a;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  cin >> s;
  cin >> m;
  if (m % 2)
    lst = 'a';
  else
    lst = 'b';
  build();
  for (int i = 0; i < m - 1; i++) {
    dp[i] = make_pair(0, 0);
  }
  for (int i = m - 1; i < n; i++) {
    if (can(i)) {
      dp[i] = make_pair(acc[i - m].first + 1, acc[i - m].second + getCost(i));
    } else {
      dp[i] = make_pair(0, 0);
    }
    acc[i] = _max((i ? acc[i - 1] : make_pair(0, 0)), dp[i]);
  }
  cout << acc[n - 1].second << "\n";
  return 0;
}

```