#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1e5 + 10;
struct node {
  long long plus_lazy;
  pair<long long, long long> set_lazy, min_val, max_val;
  node() {
    min_val = make_pair(1LL, 1LL);
    max_val = make_pair(1LL, 1LL);
    set_lazy = make_pair(-1, -1);
    plus_lazy = 0;
  }
};
node segt[4 * MAXN];
long long a[MAXN];
node merge_node(node x, node y) {
  node res;
  res.max_val = max(x.max_val, y.max_val);
  res.min_val = min(x.min_val, y.min_val);
  return res;
}
void lzu(long long id) {
  if (segt[id].set_lazy != make_pair((long long)(-1), (long long)(-1))) {
    segt[2 * id + 1].max_val = segt[id].set_lazy;
    segt[2 * id + 2].max_val = segt[id].set_lazy;
    segt[2 * id + 1].min_val = segt[id].set_lazy;
    segt[2 * id + 2].min_val = segt[id].set_lazy;
    segt[2 * id + 1].set_lazy = segt[id].set_lazy;
    segt[2 * id + 2].set_lazy = segt[id].set_lazy;
    segt[2 * id + 1].plus_lazy = 0;
    segt[2 * id + 2].plus_lazy = 0;
  }
  segt[2 * id + 1].max_val.first -= segt[id].plus_lazy;
  segt[2 * id + 2].max_val.first -= segt[id].plus_lazy;
  segt[2 * id + 1].min_val.first -= segt[id].plus_lazy;
  segt[2 * id + 2].min_val.first -= segt[id].plus_lazy;
  segt[2 * id + 1].plus_lazy += segt[id].plus_lazy;
  segt[2 * id + 2].plus_lazy += segt[id].plus_lazy;
  segt[id].plus_lazy = 0;
  segt[id].set_lazy = make_pair(-1, -1);
}
void dfs(long long id, long long L, long long R) {
  if (segt[id].min_val.first >= 0) {
    return;
  }
  if (segt[id].max_val == segt[id].min_val) {
    while (segt[id].max_val.first < 0) {
      segt[id].max_val.first += 41 * segt[id].max_val.second;
      segt[id].min_val.first += 41 * segt[id].min_val.second;
      segt[id].max_val.second *= 42;
      segt[id].min_val.second *= 42;
    }
    segt[id].set_lazy = segt[id].max_val;
    segt[id].plus_lazy = 0;
    return;
  }
  lzu(id);
  long long mid = (L + R) / 2;
  dfs(2 * id + 1, L, mid);
  dfs(2 * id + 2, mid + 1, R);
  segt[id] = merge_node(segt[2 * id + 1], segt[2 * id + 2]);
}
void set_update(long long id, long long L, long long R, long long l,
                long long r, pair<long long, long long> x) {
  if (L > r || R < l) {
    return;
  }
  if (L >= l && R <= r) {
    segt[id].min_val = x;
    segt[id].max_val = x;
    segt[id].set_lazy = x;
    segt[id].plus_lazy = 0;
    return;
  }
  lzu(id);
  long long mid = (L + R) / 2;
  set_update(2 * id + 1, L, mid, l, r, x);
  set_update(2 * id + 2, mid + 1, R, l, r, x);
  segt[id] = merge_node(segt[2 * id + 1], segt[2 * id + 2]);
}
void plus_update(long long id, long long L, long long R, long long l,
                 long long r, long long x) {
  if (L > r || R < l) {
    return;
  }
  if (L >= l && R <= r) {
    segt[id].min_val.first -= x;
    segt[id].max_val.first -= x;
    segt[id].plus_lazy += x;
    return;
  }
  lzu(id);
  long long mid = (L + R) / 2;
  plus_update(2 * id + 1, L, mid, l, r, x);
  plus_update(2 * id + 2, mid + 1, R, l, r, x);
  segt[id] = merge_node(segt[2 * id + 1], segt[2 * id + 2]);
}
long long get_index(long long id, long long L, long long R, long long p) {
  if (L > p || R < p) {
    return 0;
  }
  if (L == R) {
    return segt[id].min_val.second - segt[id].min_val.first;
  }
  lzu(id);
  long long mid = (L + R) / 2;
  return get_index(2 * id + 1, L, mid, p) +
         get_index(2 * id + 2, mid + 1, R, p);
}
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(0);
  long long n, q;
  cin >> n >> q;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    plus_update(0, 1, n, i, i, a[i]);
  }
  dfs(0, 1, n);
  for (long long i = 0; i < q; i++) {
    long long type;
    cin >> type;
    if (type == 1) {
      long long p;
      cin >> p;
      cout << get_index(0, 1, n, p) << endl;
      ;
    }
    if (type == 2) {
      long long l, r, x;
      cin >> l >> r >> x;
      set_update(0, 1, n, l, r, make_pair(1 - x, 1));
    }
    if (type == 3) {
      long long l, r, x;
      cin >> l >> r >> x;
      plus_update(0, 1, n, l, r, x);
      dfs(0, 1, n);
      while (segt[0].min_val.first == 0) {
        plus_update(0, 1, n, l, r, x);
        dfs(0, 1, n);
      }
    }
    dfs(0, 1, n);
  }
}
