#include <bits/stdc++.h>
const long long Infll = 0x3f3f3f3f3f3f3f3f;
const int MN = 100005, MS = 1 << 18 | 7;
long long Z[10];
void Init() {
  Z[0] = 1;
  for (int i = 1; i <= 9; ++i) Z[i] = Z[i - 1] * 42;
}
inline int gv(long long x) { return std::lower_bound(Z, Z + 10, x) - Z; }
int N, Q, A[MN];
long long t1[MS], t3[MS], mn[MS];
int t2[MS];
inline void P1(int i, long long df, int vl) {
  mn[i] = t1[i] = df, t2[i] = vl, t3[i] = 0;
}
inline void P2(int i, long long tg) {
  if (t2[i]) {
    t1[i] -= tg;
    while (t1[i] < 0) t1[i] += Z[t2[i] + 1] - Z[t2[i]], ++t2[i];
    mn[i] = t1[i];
  } else
    mn[i] -= tg, t3[i] += tg;
}
inline void Pushdown(int i) {
  if (t1[i])
    P1((i << 1), t1[i], t2[i]), P1(((i << 1) | 1), t1[i], t2[i]),
        t1[i] = t2[i] = 0;
  if (t3[i]) P2((i << 1), t3[i]), P2(((i << 1) | 1), t3[i]), t3[i] = 0;
}
void Mdf(int i, int l, int r, int a, int b, long long df, int vl) {
  if (r < a || b < l) return;
  if (a <= l && r <= b) return P1(i, df, vl);
  Pushdown(i), Mdf((i << 1), l, ((l + r) >> 1), a, b, df, vl),
      Mdf(((i << 1) | 1), ((l + r) >> 1) + 1, r, a, b, df, vl);
  mn[i] = std::min(mn[(i << 1)], mn[((i << 1) | 1)]);
}
long long Add(int i, int l, int r, int a, int b, long long x) {
  if (r < a || b < l) return Infll;
  if (a <= l && r <= b && (mn[i] >= x || t2[i])) return P2(i, x), mn[i];
  Pushdown(i), Add((i << 1), l, ((l + r) >> 1), a, b, x),
      Add(((i << 1) | 1), ((l + r) >> 1) + 1, r, a, b, x);
  return mn[i] = std::min(mn[(i << 1)], mn[((i << 1) | 1)]);
}
long long Get(int i, int l, int r, int p) {
  if (l == r) return Z[t2[i]] - t1[i];
  Pushdown(i);
  return p <= ((l + r) >> 1) ? Get((i << 1), l, ((l + r) >> 1), p)
                             : Get(((i << 1) | 1), ((l + r) >> 1) + 1, r, p);
}
int main() {
  Init();
  scanf("%d%d", &N, &Q);
  for (int i = 1, x; i <= N; ++i) {
    scanf("%d", &x);
    Mdf(1, 1, N, i, i, Z[gv(x)] - x, gv(x));
  }
  while (Q--) {
    int o, l, r, x;
    scanf("%d%d", &o, &l);
    if (o == 1)
      printf("%lld\n", Get(1, 1, N, l));
    else if (o == 2) {
      scanf("%d%d", &r, &x);
      Mdf(1, 1, N, l, r, Z[gv(x)] - x, gv(x));
    } else {
      scanf("%d%d", &r, &x);
      while (!Add(1, 1, N, l, r, x))
        ;
    }
  }
  return 0;
}
