#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 500;
long long bad[14], a[N << 2], tagc[N << 2], taga[N << 2];
int w[N], n, qn;
void pre_bad() {
  long long pw = 1;
  for (int i = 0; i <= 11; i++) bad[i] = pw, pw *= 42;
}
void cov(int rot, long long w) {
  tagc[rot] = w, taga[rot] = 0;
  a[rot] = *(lower_bound(bad, bad + 12, w)) - w;
}
void pushdown(int);
void add(int rot, long long w) {
  if (tagc[rot]) {
    cov(rot, tagc[rot] + w);
    return;
  }
  if (a[rot] < w) {
    pushdown(rot);
    add(rot << 1, w), add(rot << 1 | 1, w);
    a[rot] = min(a[rot << 1], a[rot << 1 | 1]);
    return;
  }
  a[rot] -= w, taga[rot] += w;
}
void pushdown(int rot) {
  if (tagc[rot]) {
    long long t = tagc[rot];
    tagc[rot] = 0;
    cov(rot << 1, t), cov(rot << 1 | 1, t);
    return;
  }
  long long t = taga[rot];
  taga[rot] = 0;
  add(rot << 1, t), add(rot << 1 | 1, t);
}
void update(int rot, int lt, int rt, int lq, int rq, int w,
            void upd(int, long long)) {
  if (lt >= lq && rt <= rq) {
    upd(rot, w);
    return;
  }
  int mid = (lt + rt) >> 1;
  pushdown(rot);
  if (lq <= mid) update(rot << 1, lt, mid, lq, rq, w, upd);
  if (rq > mid) update(rot << 1 | 1, mid + 1, rt, lq, rq, w, upd);
  a[rot] = min(a[rot << 1], a[rot << 1 | 1]);
}
long long query(int rot, int lt, int rt, int q) {
  if (lt == rt) return tagc[rot];
  pushdown(rot);
  int mid = (lt + rt) >> 1;
  if (q <= mid) return query(rot << 1, lt, mid, q);
  return query(rot << 1 | 1, mid + 1, rt, q);
}
void build(int rot, int lt, int rt) {
  if (lt == rt) {
    cov(rot, w[lt]);
    return;
  }
  int mid = (lt + rt) >> 1;
  build(rot << 1, lt, mid), build(rot << 1 | 1, mid + 1, rt);
  a[rot] = min(a[rot << 1], a[rot << 1 | 1]);
}
int main() {
  scanf("%d%d", &n, &qn);
  for (int i = 1; i <= n; i++) scanf("%d", w + i);
  pre_bad();
  build(1, 1, n);
  for (int i = 1, opt, l, r, x; i <= qn; i++) {
    scanf("%d%d", &opt, &l);
    switch (opt) {
      case 1:
        printf("%lld\n", query(1, 1, n, l));
        break;
      case 2:
        scanf("%d%d", &r, &x), update(1, 1, n, l, r, x, cov);
        break;
      case 3: {
        scanf("%d%d", &r, &x);
        update(1, 1, n, l, r, x, add);
        while (!a[1]) update(1, 1, n, l, r, x, add);
        break;
      }
    }
  }
}
