#pragma GCC optimize("Ofast")
#pragma GCC target("avx2,popcnt")
#include "bits/stdc++.h"
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
#define rep1n(i, n) for (int i = 1; i <= (n); ++i)
#define repr(i, n) for (int i = (n) - 1; i >= 0; --i)
#define pb push_back
#define eb emplace_back
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define each(x, a) for (auto &x : a)
#define ar array
#define vec vector
#define range(i, n) rep(i, n)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using str = string;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vpi = vector<pair<int, int>>;
using vvi = vector<vi>;
int Bit(int mask, int b) { return (mask >> b) & 1; }
template<class T>
bool ckmin(T &a, const T &b) {
if (b < a) {
a = b;
return true;
}
return false;
}
template<class T>
bool ckmax(T &a, const T &b) {
if (b > a) {
a = b;
return true;
}
return false;
}
// [l, r)
template<typename T, typename F>
T FindFirstTrue(T l, T r, const F &predicat) {
--l;
while (r - l > 1) {
T mid = l + (r - l) / 2;
if (predicat(mid)) {
r = mid;
} else {
l = mid;
}
}
return r;
}
template<typename T, typename F>
T FindLastFalse(T l, T r, const F &predicat) {
return FindFirstTrue(l, r, predicat) - 1;
}
const ll INF = 2e18;
const int INFi = 1e9;
const int LG = 49;
const int N = 1e4 + 4;
template<int SZ>
struct hash_t {
static bool initialized;
static int MOD[SZ], BASE[SZ];
static std::vector<int> POWER[SZ];
static void initialize() {
assert(!initialized);
initialized = true;
std::mt19937 rng(std::chrono::steady_clock::now().time_since_epoch().count());
for (int i = 0; i < SZ; i++) {
auto is_prime = [&](int x) {
for (int i = 2; i * i <= x; i++)
if (x % i == 0)
return false;
return true;
};
MOD[i] = int(8e5) + rng() % int(2e8 + 228);
while (!is_prime(MOD[i]))
MOD[i]++;
BASE[i] = rng() % MOD[i];
if (!(BASE[i] & 1))
BASE[i]++;
POWER[i].push_back(1);
}
}
static void ensure(int n) {
assert(initialized);
if (int(POWER[0].size()) >= n)
return;
for (int i = 0; i < SZ; i++)
for (int j = POWER[i].size(); j < n; j++)
POWER[i].push_back(int64_t(POWER[i].back()) * BASE[i] % MOD[i]);
}
int length;
std::array<int, SZ> h;
hash_t() : length(0) {
h.fill(0);
if (!initialized)
initialize();
}
template<typename T>
hash_t(const T &value, int length = 1) : length(length) {
if (!initialized)
initialize();
ensure(length);
h.fill(0);
for (int i = 0; i < SZ; i++)
for (int j = 0; j < length; j++) {
h[i] += int64_t(value) * POWER[i][j] % MOD[i];
if (h[i] >= MOD[i])
h[i] -= MOD[i];
}
}
hash_t<SZ> &operator+=(const hash_t<SZ> &x) {
assert(initialized);
ensure(x.length + 1);
for (int i = 0; i < SZ; i++)
h[i] = (int64_t(h[i]) * POWER[i][x.length] + x.h[i]) % MOD[i];
length += x.length;
return *this;
}
hash_t<SZ> &operator-=(const hash_t<SZ> &x) {
assert(initialized);
assert(x.length <= length);
ensure(length - x.length + 1);
for (int i = 0; i < SZ; i++) {
h[i] -= int64_t(x.h[i]) * POWER[i][length - x.length] % MOD[i];
if (h[i] < 0)
h[i] += MOD[i];
}
length -= x.length;
return *this;
}
bool operator==(const hash_t<SZ> &x) const {
if (length != x.length)
return false;
return h == x.h;
}
bool operator<(const hash_t<SZ> &x) const {
if (length != x.length)
return length < x.length;
return h < x.h;
}
friend hash_t<SZ> operator+(const hash_t<SZ> &left, const hash_t<SZ> &right) {
return hash_t<SZ>(left) += right;
}
friend hash_t<SZ> operator-(const hash_t<SZ> &left, const hash_t<SZ> &right) {
return hash_t<SZ>(left) -= right;
}
};
template<int SZ> bool hash_t<SZ>::initialized = false;
template<int SZ> int hash_t<SZ>::MOD[SZ] = {};
template<int SZ> int hash_t<SZ>::BASE[SZ] = {};
template<int SZ> std::vector<int> hash_t<SZ>::POWER[SZ] = {};
using Hash = hash_t<2>;
struct SegTree {
struct Node {
Hash h_suf;
Hash h_pref;
ll mx;
ll upd;
void apply(ll x) {
mx += x;
upd += x;
}
void combine(const Node &a, const Node &b) {
mx = max(a.mx, b.mx);
h_suf = a.h_suf + b.h_suf;
h_pref = b.h_pref + a.h_pref;
}
Node(ll v = 0) : h_suf(), h_pref(), mx(v), upd(0) {}
};
Node combine(const Node &a, const Node &b) {
Node c;
c.combine(a, b);
return c;
}
vector<Node> t;
int n;
void build(int sz) {
t.resize(sz * 4);
n = sz;
}
void pull(int v) {
t[v].combine(t[v << 1], t[v << 1 | 1]);
}
void push(int v) {
if (!t[v].upd) return;
t[v << 1].apply(t[v].upd);
t[v << 1 | 1].apply(t[v].upd);
t[v].upd = 0;
}
void Set(int v, int l, int r, int pos, ll x) {
if (l > pos || r <= pos) return;
if (l + 1 == r) {
t[v].h_pref = t[v].h_suf = Hash(x);
return;
}
push(v);
Set(v << 1, l, (l + r) >> 1, pos, x);
Set(v << 1 | 1, (l + r) >> 1, r, pos, x);
pull(v);
}
void Set(int pos, ll x) {
Set(1, 0, n, pos, x);
}
void Add(int v, int l, int r, int lq, int rq, ll x) {
if (l >= rq || r <= lq) return;
if (lq <= l && r <= rq) {
t[v].apply(x);
return;
}
push(v);
Add(v << 1, l, (l + r) >> 1, lq, rq, x);
Add(v << 1 | 1, (l + r) >> 1, r, lq, rq, x);
pull(v);
}
void Add(int lq, int rq, ll x) {
Add(1, 0, n, lq, rq, x);
}
Node Get(int v, int l, int r, int lq, int rq) {
if (l >= rq || r <= lq) return Node(-INF);
if (lq <= l && r <= rq) return t[v];
push(v);
return combine(Get(v << 1, l, (l + r) >> 1, lq, rq), Get(v << 1 | 1, (l + r) >> 1, r, lq, rq));
}
Node Get(int lq, int rq) {
return Get(1, 0, n, lq, rq);
}
};
void solve() {
int n, q;
ll k, b;
cin >> n >> q >> k >> b;
vl a(n);
rep(i, n) {
cin >> a[i];
a[i] *= 2;
a[i] -= 1ll * i * k;
}
b *= 2;
SegTree st;
st.build(n + 1);
vl diff(n + 1, 0);
auto update = [&](int lq, int rq, ll v) {
st.Add(lq, rq, v);
diff[lq] += v;
st.Set(lq, diff[lq]);
diff[rq] -= v;
st.Set(rq, diff[rq]);
};
rep(i, n) update(i, i + 1, a[i]);
rep(_, q) {
int tp;
cin >> tp;
if (tp == 1) {
int l, r;
ll v;
cin >> l >> r >> v;
update(l - 1, r, v * 2);
continue;
}
int i;
cin >> i;
i--;
int ans = 0;
if (i > 0 && i + 1 < n) {
if (st.Get(i + 1, i + 2).mx - st.Get(i - 1, i).mx == b) {
ans++;
} else {
assert(diff[i + 1] + diff[i] != b);
}
}
for(int t = (1 << 20); t > 0; t /= 2) {
if (!ans) break;
if (i - ans - t < 0 || i + ans + t >= n) continue;
auto lv = st.Get(i - ans - t + 1, i - ans + 1).h_suf;
auto rv = st.Get(i + ans + 1, i + ans + t + 1).h_pref;
bool ok = true;
rep(j, 2) {
if ((lv.h[j] + rv.h[j]) % hash_t<2>::MOD[j] != 0) {
ok = false;
break;
}
}
if (!ok) continue;
ans += t;
}
cout << ans << '\n';
}
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout << setprecision(12) << fixed;
int t = 1;
// cin >> t;
rep(i, t) {
solve();
}
return 0;
}