#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:66777216")
#pragma warning(disable : 4996)
#pragma hdrstop
template <class T>
inline bool umin(T& a, const T& b) {
  return (b < a ? a = b, true : false);
}
namespace std {}
namespace Random {}
inline bool is_digit(const char ch) { return (ch >= '0' && ch <= '9'); }
class IO {
 public:
  constexpr static const std::size_t kBufferSize = 1 << 18;
  IO()
      : read_bytes_count_(0),
        read_buffer_offset_(0),
        current_char_(0),
        eof_(false) {
    static_assert(kBufferSize > 32,
                  "Size of a buffer must be greater than 32 due to comparison "
                  "in IO::flush() method.");
  }
  ~IO() { flush(); }
  IO(const IO&) = delete;
  IO& operator=(const IO&) = delete;
  IO(const IO&&) = delete;
  IO& operator=(const IO&&) = delete;
  inline void shift_char();
  inline int32_t next_int();
  IO& operator>>(int32_t& x);
  inline void flush();
  inline void new_line();
  inline void print_int(const int32_t x);
  IO& operator<<(const int32_t x);
  IO& operator<<(std::ostream& (*)(std::ostream&));

 private:
  using Buffer = std::array<char, kBufferSize>;
  Buffer read_buffer_;
  Buffer write_buffer_;
  std::size_t read_bytes_count_;
  std::size_t read_buffer_offset_;
  std::size_t write_buffer_offset_;
  bool eof_;
  char current_char_;
  inline void update_buffer();
  template <typename T>
  T read_number();
  template <typename T>
  void print_number(const T& value);
};
extern bool useFastIO;
extern std::istream* pin;
extern std::ostream* pout;
extern IO io;
inline int32_t next_int();
inline void new_line();
inline void print_int(const int32_t x);
using namespace std;
int __;
IO io;
template <typename T>
class SegmentTreeSum {
 public:
  SegmentTreeSum(const int P, const size_t N,
                 const T& neutral_ = static_cast<T>(0))
      : P_(P), N_(N), neutral_(neutral_) {
    offset_ = 1 << (31 - __builtin_clz(N) + ((N & (N - 1)) == 0 ? 0 : 1));
    size_ = offset_ << 1;
    data_.resize(size_);
    init();
  }
  SegmentTreeSum() = delete;
  SegmentTreeSum(SegmentTreeSum&) = default;
  SegmentTreeSum(SegmentTreeSum&&) = default;
  SegmentTreeSum& operator=(SegmentTreeSum&) = default;
  SegmentTreeSum& operator=(SegmentTreeSum&&) = default;
  ~SegmentTreeSum() = default;
  void init() { std::fill_n(data_.begin(), data_.size(), neutral_); }
  T query(const size_t left, const size_t right) const {
    T res = neutral_;
    for (size_t l = left + offset_, r = right + offset_; l <= r;
         l >>= 1, r >>= 1) {
      if (l & 1) {
        res += data_[l++];
      }
      if ((r & 1) == 0) {
        res += data_[r--];
      }
    }
    return res;
  }
  void update(const size_t position, const T& value) {
    size_t pos = position + offset_;
    data_[pos] += value;
    umin(data_[pos], P_);
    for (pos >>= 1; pos >= 1; pos >>= 1) {
      data_[pos] = data_[pos << 1] + data_[(pos << 1) ^ 1];
    }
  }

 private:
  int P_;
  std::vector<T> data_;
  const T neutral_;
  size_t offset_;
  size_t size_;
  size_t N_;
};
void solve(istream& ins, ostream& out) {
  int n, k, a, b;
  io >> n >> k >> a >> b >> __;
  SegmentTreeSum<int> tree_a(a, n), tree_b(b, n);
  for (int _ = 0; _ < __; ++_) {
    int type, day;
    io >> type >> day;
    if (type == 1) {
      int cnt;
      io >> cnt;
      tree_a.update(day - 1, cnt);
      tree_b.update(day - 1, cnt);
    } else {
      int ans = tree_b.query(0, day - 2);
      ans += tree_a.query(day + k - 1, n - 1);
      io << ans << endl;
    }
  }
}
extern class IO io;
bool useFastIO = false;
istream* pin;
ostream* pout;
int main() {
  srand(time(NULL));
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  istream& in = cin;
  useFastIO = true;
  ostream& out = cout;
  out << fixed << setprecision(16);
  pin = &in;
  pout = &out;
  solve(in, out);
  return 0;
}
template <typename T>
T IO::read_number() {
  bool is_negative = false;
  while (!eof_ && !is_digit(current_char_) &&
         (std::is_unsigned<T>() || current_char_ != '-')) {
    shift_char();
  }
  if (std::is_signed<T>() && current_char_ == '-') {
    is_negative = true;
    shift_char();
  }
  T result = 0;
  while (!eof_ && is_digit(current_char_)) {
    result = (result << 3) + (result << 1) + current_char_ - '0';
    shift_char();
  }
  return (is_negative ? result * -1 : result);
}
template <typename T>
void IO::print_number(const T& value) {
  T current_value = value;
  if (write_buffer_offset_ + 32 > kBufferSize) {
    flush();
  }
  if (current_value < 0) {
    write_buffer_[write_buffer_offset_++] = '-';
    current_value = abs(current_value);
  } else if (current_value == 0) {
    write_buffer_[write_buffer_offset_++] = '0';
    return;
  }
  std::size_t start_index = write_buffer_offset_;
  while (current_value != 0) {
    write_buffer_[write_buffer_offset_++] = current_value % 10 + '0';
    current_value /= 10;
  }
  std::reverse(write_buffer_.begin() + start_index,
               write_buffer_.begin() + write_buffer_offset_);
}
inline void IO::update_buffer() {
  if (read_buffer_offset_ == read_bytes_count_) {
    read_bytes_count_ = fread(&read_buffer_[0], sizeof(read_buffer_[0]),
                              read_buffer_.size(), stdin);
    if (read_bytes_count_ == 0) {
      eof_ = true;
      return;
    }
    read_buffer_offset_ = 0;
  }
}
inline void IO::shift_char() {
  update_buffer();
  current_char_ = read_buffer_[read_buffer_offset_++];
}
inline int32_t IO::next_int() { return read_number<int32_t>(); }
IO& IO::operator>>(int32_t& x) {
  x = ::next_int();
  return *this;
}
inline void IO::flush() {
  fwrite(&write_buffer_[0], sizeof(write_buffer_[0]), write_buffer_offset_,
         stdout);
  write_buffer_offset_ = 0;
}
inline void IO::new_line() {
  if (write_buffer_offset_ == kBufferSize) {
    flush();
  }
  write_buffer_[write_buffer_offset_++] = '\n';
}
inline void IO::print_int(const int32_t x) { print_number(x); }
IO& IO::operator<<(const int32_t x) {
  ::print_int(x);
  return *this;
}
IO& IO::operator<<(std::ostream& (*)(std::ostream&)) {
  ::new_line();
  return *this;
}
inline int32_t next_int() {
  if (useFastIO) {
    return io.next_int();
  }
  int32_t ret;
  *pin >> ret;
  return ret;
}
inline void new_line() {
  if (useFastIO) {
    io.new_line();
    return;
  }
  *pout << std::endl;
}
inline void print_int(const int32_t x) {
  if (useFastIO) {
    io.print_int(x);
    return;
  }
  *pout << x;
}

### Prompt

Please create a solution in CPP to the following problem:

A factory produces thimbles in bulk. Typically, it can produce up to a thimbles a day. However, some of the machinery is defective, so it can currently only produce b thimbles each day. The factory intends to choose a k-day period to do maintenance and construction; it cannot produce any thimbles during this time, but will be restored to its full production of a thimbles per day after the k days are complete.

Initially, no orders are pending. The factory receives updates of the form di, ai, indicating that ai new orders have been placed for the di-th day. Each order requires a single thimble to be produced on precisely the specified day. The factory may opt to fill as many or as few of the orders in a single batch as it likes.

As orders come in, the factory owner would like to know the maximum number of orders he will be able to fill if he starts repairs on a given day pi. Help the owner answer his questions.

Input

The first line contains five integers n, k, a, b, and q (1 ≤ k ≤ n ≤ 200 000, 1 ≤ b < a ≤ 10 000, 1 ≤ q ≤ 200 000) — the number of days, the length of the repair time, the production rates of the factory, and the number of updates, respectively.

The next q lines contain the descriptions of the queries. Each query is of one of the following two forms: 

  * 1 di ai (1 ≤ di ≤ n, 1 ≤ ai ≤ 10 000), representing an update of ai orders on day di, or 
  * 2 pi (1 ≤ pi ≤ n - k + 1), representing a question: at the moment, how many orders could be filled if the factory decided to commence repairs on day pi? 



It's guaranteed that the input will contain at least one query of the second type.

Output

For each query of the second type, print a line containing a single integer — the maximum number of orders that the factory can fill over all n days.

Examples

Input

5 2 2 1 8
1 1 2
1 5 3
1 2 1
2 2
1 4 2
1 3 2
2 1
2 3


Output

3
6
4


Input

5 4 10 1 6
1 1 5
1 5 5
1 3 2
1 5 2
2 1
2 2


Output

7
1

Note

Consider the first sample.

We produce up to 1 thimble a day currently and will produce up to 2 thimbles a day after repairs. Repairs take 2 days.

For the first question, we are able to fill 1 order on day 1, no orders on days 2 and 3 since we are repairing, no orders on day 4 since no thimbles have been ordered for that day, and 2 orders for day 5 since we are limited to our production capacity, for a total of 3 orders filled.

For the third question, we are able to fill 1 order on day 1, 1 order on day 2, and 2 orders on day 5, for a total of 4 orders.

### Response

```cpp
#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:66777216")
#pragma warning(disable : 4996)
#pragma hdrstop
template <class T>
inline bool umin(T& a, const T& b) {
  return (b < a ? a = b, true : false);
}
namespace std {}
namespace Random {}
inline bool is_digit(const char ch) { return (ch >= '0' && ch <= '9'); }
class IO {
 public:
  constexpr static const std::size_t kBufferSize = 1 << 18;
  IO()
      : read_bytes_count_(0),
        read_buffer_offset_(0),
        current_char_(0),
        eof_(false) {
    static_assert(kBufferSize > 32,
                  "Size of a buffer must be greater than 32 due to comparison "
                  "in IO::flush() method.");
  }
  ~IO() { flush(); }
  IO(const IO&) = delete;
  IO& operator=(const IO&) = delete;
  IO(const IO&&) = delete;
  IO& operator=(const IO&&) = delete;
  inline void shift_char();
  inline int32_t next_int();
  IO& operator>>(int32_t& x);
  inline void flush();
  inline void new_line();
  inline void print_int(const int32_t x);
  IO& operator<<(const int32_t x);
  IO& operator<<(std::ostream& (*)(std::ostream&));

 private:
  using Buffer = std::array<char, kBufferSize>;
  Buffer read_buffer_;
  Buffer write_buffer_;
  std::size_t read_bytes_count_;
  std::size_t read_buffer_offset_;
  std::size_t write_buffer_offset_;
  bool eof_;
  char current_char_;
  inline void update_buffer();
  template <typename T>
  T read_number();
  template <typename T>
  void print_number(const T& value);
};
extern bool useFastIO;
extern std::istream* pin;
extern std::ostream* pout;
extern IO io;
inline int32_t next_int();
inline void new_line();
inline void print_int(const int32_t x);
using namespace std;
int __;
IO io;
template <typename T>
class SegmentTreeSum {
 public:
  SegmentTreeSum(const int P, const size_t N,
                 const T& neutral_ = static_cast<T>(0))
      : P_(P), N_(N), neutral_(neutral_) {
    offset_ = 1 << (31 - __builtin_clz(N) + ((N & (N - 1)) == 0 ? 0 : 1));
    size_ = offset_ << 1;
    data_.resize(size_);
    init();
  }
  SegmentTreeSum() = delete;
  SegmentTreeSum(SegmentTreeSum&) = default;
  SegmentTreeSum(SegmentTreeSum&&) = default;
  SegmentTreeSum& operator=(SegmentTreeSum&) = default;
  SegmentTreeSum& operator=(SegmentTreeSum&&) = default;
  ~SegmentTreeSum() = default;
  void init() { std::fill_n(data_.begin(), data_.size(), neutral_); }
  T query(const size_t left, const size_t right) const {
    T res = neutral_;
    for (size_t l = left + offset_, r = right + offset_; l <= r;
         l >>= 1, r >>= 1) {
      if (l & 1) {
        res += data_[l++];
      }
      if ((r & 1) == 0) {
        res += data_[r--];
      }
    }
    return res;
  }
  void update(const size_t position, const T& value) {
    size_t pos = position + offset_;
    data_[pos] += value;
    umin(data_[pos], P_);
    for (pos >>= 1; pos >= 1; pos >>= 1) {
      data_[pos] = data_[pos << 1] + data_[(pos << 1) ^ 1];
    }
  }

 private:
  int P_;
  std::vector<T> data_;
  const T neutral_;
  size_t offset_;
  size_t size_;
  size_t N_;
};
void solve(istream& ins, ostream& out) {
  int n, k, a, b;
  io >> n >> k >> a >> b >> __;
  SegmentTreeSum<int> tree_a(a, n), tree_b(b, n);
  for (int _ = 0; _ < __; ++_) {
    int type, day;
    io >> type >> day;
    if (type == 1) {
      int cnt;
      io >> cnt;
      tree_a.update(day - 1, cnt);
      tree_b.update(day - 1, cnt);
    } else {
      int ans = tree_b.query(0, day - 2);
      ans += tree_a.query(day + k - 1, n - 1);
      io << ans << endl;
    }
  }
}
extern class IO io;
bool useFastIO = false;
istream* pin;
ostream* pout;
int main() {
  srand(time(NULL));
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  istream& in = cin;
  useFastIO = true;
  ostream& out = cout;
  out << fixed << setprecision(16);
  pin = &in;
  pout = &out;
  solve(in, out);
  return 0;
}
template <typename T>
T IO::read_number() {
  bool is_negative = false;
  while (!eof_ && !is_digit(current_char_) &&
         (std::is_unsigned<T>() || current_char_ != '-')) {
    shift_char();
  }
  if (std::is_signed<T>() && current_char_ == '-') {
    is_negative = true;
    shift_char();
  }
  T result = 0;
  while (!eof_ && is_digit(current_char_)) {
    result = (result << 3) + (result << 1) + current_char_ - '0';
    shift_char();
  }
  return (is_negative ? result * -1 : result);
}
template <typename T>
void IO::print_number(const T& value) {
  T current_value = value;
  if (write_buffer_offset_ + 32 > kBufferSize) {
    flush();
  }
  if (current_value < 0) {
    write_buffer_[write_buffer_offset_++] = '-';
    current_value = abs(current_value);
  } else if (current_value == 0) {
    write_buffer_[write_buffer_offset_++] = '0';
    return;
  }
  std::size_t start_index = write_buffer_offset_;
  while (current_value != 0) {
    write_buffer_[write_buffer_offset_++] = current_value % 10 + '0';
    current_value /= 10;
  }
  std::reverse(write_buffer_.begin() + start_index,
               write_buffer_.begin() + write_buffer_offset_);
}
inline void IO::update_buffer() {
  if (read_buffer_offset_ == read_bytes_count_) {
    read_bytes_count_ = fread(&read_buffer_[0], sizeof(read_buffer_[0]),
                              read_buffer_.size(), stdin);
    if (read_bytes_count_ == 0) {
      eof_ = true;
      return;
    }
    read_buffer_offset_ = 0;
  }
}
inline void IO::shift_char() {
  update_buffer();
  current_char_ = read_buffer_[read_buffer_offset_++];
}
inline int32_t IO::next_int() { return read_number<int32_t>(); }
IO& IO::operator>>(int32_t& x) {
  x = ::next_int();
  return *this;
}
inline void IO::flush() {
  fwrite(&write_buffer_[0], sizeof(write_buffer_[0]), write_buffer_offset_,
         stdout);
  write_buffer_offset_ = 0;
}
inline void IO::new_line() {
  if (write_buffer_offset_ == kBufferSize) {
    flush();
  }
  write_buffer_[write_buffer_offset_++] = '\n';
}
inline void IO::print_int(const int32_t x) { print_number(x); }
IO& IO::operator<<(const int32_t x) {
  ::print_int(x);
  return *this;
}
IO& IO::operator<<(std::ostream& (*)(std::ostream&)) {
  ::new_line();
  return *this;
}
inline int32_t next_int() {
  if (useFastIO) {
    return io.next_int();
  }
  int32_t ret;
  *pin >> ret;
  return ret;
}
inline void new_line() {
  if (useFastIO) {
    io.new_line();
    return;
  }
  *pout << std::endl;
}
inline void print_int(const int32_t x) {
  if (useFastIO) {
    io.print_int(x);
    return;
  }
  *pout << x;
}

```