#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
const long long inf = 1e15;
int n, q;
set<int> hs;
long long lz[4 * maxn], lz1[4 * maxn], nxt[4 * maxn], lz2[4 * maxn], p[20], cnt;
pair<long long, long long> bt[4 * maxn];
void make(int u, int l, long long v, long long nx) {
  bt[u] = {v, l};
  nxt[u] = nx;
  lz[u] = v;
  lz2[u] = nx;
  lz1[u] = 0;
}
void make2(int u, long long v) {
  lz1[u] += v;
  bt[u].first += v;
}
void shift(int u, int l, int r) {
  int mid = (l + r) / 2;
  if (lz[u] != -1) {
    make(2 * u, l, lz[u], lz2[u]);
    make(2 * u + 1, l, lz[u], lz2[u]);
  } else {
    make2(2 * u, lz1[u]);
    make2(2 * u + 1, lz1[u]);
  }
  lz[u] = lz2[u] = -1;
  lz1[u] = 0;
}
void ups(int u, int l, int r, int f, int s, long long v, long long nxt) {
  if (f >= r || l >= s) return;
  if (f <= l && r <= s) {
    make(u, l, v, nxt);
    return;
  }
  shift(u, l, r);
  int md = (l + r) >> 1;
  ups(2 * u, l, md, f, s, v, nxt);
  ups(2 * u + 1, md, r, f, s, v, nxt);
  bt[u] = min(bt[2 * u], bt[2 * u + 1]);
}
void upp(int u, int l, int r, int f, int s, long long v) {
  if (f >= r || l >= s) return;
  if (f <= l && r <= s) {
    make2(u, v);
    return;
  }
  shift(u, l, r);
  int md = (l + r) >> 1;
  upp(2 * u, l, md, f, s, v);
  upp(2 * u + 1, md, r, f, s, v);
  bt[u] = min(bt[2 * u], bt[2 * u + 1]);
}
pair<long long, long long> gt(int u, int l, int r, int f, int s) {
  if (f >= r || l >= s) return {inf, -1};
  if (f <= l && r <= s) return bt[u];
  shift(u, l, r);
  int md = (l + r) >> 1;
  pair<long long, long long> re = {inf, -1};
  re = min(re, gt(2 * u, l, md, f, s));
  re = min(re, gt(2 * u + 1, md, r, f, s));
  return re;
}
long long query(int u, int l, int r, int x) {
  if (r - l == 1) return nxt[u] - bt[u].first;
  shift(u, l, r);
  int md = (l + r) >> 1;
  long long re = 0;
  if (x < md)
    re += query(2 * u, l, md, x);
  else
    re += query(2 * u + 1, md, r, x);
  return re;
}
void fnd(int u) {
  if (u < 0 || u >= n) return;
  int x = *hs.lower_bound(u);
  long long v = query(1, 0, n, x);
  long long nxt = p[lower_bound(p, p + cnt, v) - p];
  ups(1, 0, n, u, u + 1, nxt - v, nxt);
  hs.insert(u);
}
void d(int l, int r, long long v) {
  fnd(l - 1);
  fnd(r - 1);
  long long nxt = p[lower_bound(p, p + cnt, v) - p];
  ups(1, 0, n, r - 1, r, nxt - v, nxt);
  ups(1, 0, n, l, r - 1, inf, inf);
  hs.insert(r - 1);
  while (*hs.lower_bound(l) < r - 1) hs.erase(hs.lower_bound(l));
}
void upe(int l, int r, long long v) {
  fnd(l - 1);
  fnd(r - 1);
  do {
    upp(1, 0, n, l, r, -v);
    while (gt(1, 0, n, l, r).first < 0) {
      int x = gt(1, 0, n, l, r).second;
      d(x, x + 1, query(1, 0, n, x));
    }
  } while (gt(1, 0, n, l, r).first == 0);
}
int main() {
  ios::sync_with_stdio(false);
  memset(lz, -1, sizeof lz);
  memset(lz1, -1, sizeof lz1);
  p[0] = 1;
  while (p[cnt] * 42 < inf) cnt++, p[cnt] = p[cnt - 1] * 42;
  cnt++;
  p[cnt] = inf;
  cnt++;
  cin >> n >> q;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    long long nxt = p[lower_bound(p, p + cnt, x) - p];
    ups(1, 0, n, i, i + 1, nxt - x, nxt);
    hs.insert(i);
  }
  while (q--) {
    int t, l, r, x;
    cin >> t >> l;
    l--;
    if (t == 1) {
      fnd(l);
      cout << query(1, 0, n, l) << endl;
      continue;
    }
    cin >> r >> x;
    if (t == 2)
      d(l, r, x);
    else
      upe(l, r, x);
  }
  return 0;
}
