#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 7;
int n, q;
long long w[N], a[N], b[N], c[N], f[N];
bool tg[N];
inline int read() {
  int num = 0;
  char g = getchar();
  while (g < 48 || 57 < g) g = getchar();
  while (47 < g && g < 58)
    num = (num << 1) + (num << 3) + g - 48, g = getchar();
  return num;
}
inline long long getdis(long long v) {
  for (int i = 0; i <= 9; i++)
    if (w[i] >= v) return w[i];
}
inline void build(int l, int r, int t) {
  if (l == r) {
    tg[t] = 1, a[t] = f[l], b[t] = getdis(a[t]) - a[t];
    return;
  }
  int d = (l + r) >> 1;
  build(l, d, t << 1), build(d + 1, r, t << 1 | 1),
      b[t] = min(b[t << 1], b[t << 1 | 1]);
}
inline long long getans(int l, int r, int t, int x) {
  if (c[t])
    a[t << 1] += c[t], a[t << 1 | 1] += c[t], b[t << 1] -= c[t],
        b[t << 1 | 1] -= c[t], c[t << 1] += c[t], c[t << 1 | 1] += c[t],
        c[t] = 0;
  if (tg[t]) return a[t];
  int d = (l + r) >> 1;
  if (x <= d) return getans(l, d, t << 1, x);
  if (d + 1 <= x) getans(d + 1, r, t << 1 | 1, x);
}
inline void coverx(int l, int r, int t, int ql, int qr, int x) {
  if (c[t] && l != r)
    a[t << 1] += c[t], a[t << 1 | 1] += c[t], b[t << 1] -= c[t],
        b[t << 1 | 1] -= c[t], c[t << 1] += c[t], c[t << 1 | 1] += c[t],
        c[t] = 0;
  if (tg[t] && l != r)
    a[t << 1] = a[t], a[t << 1 | 1] = a[t], b[t << 1] = b[t],
           b[t << 1 | 1] = b[t], tg[t << 1] = 1, tg[t << 1 | 1] = 1;
  tg[t] = 0;
  if (l == ql && r == qr) {
    tg[t] = 1, a[t] = x, b[t] = getdis(a[t]) - x, c[t] = 0;
    return;
  }
  int d = (l + r) >> 1;
  if (ql <= d) coverx(l, d, t << 1, ql, min(d, qr), x);
  if (d + 1 <= qr) coverx(d + 1, r, t << 1 | 1, max(d + 1, ql), qr, x);
  b[t] = min(b[t << 1], b[t << 1 | 1]);
}
inline bool adds(int l, int r, int t, int ql, int qr, int x) {
  if (c[t] && l != r)
    a[t << 1] += c[t], a[t << 1 | 1] += c[t], b[t << 1] -= c[t],
        b[t << 1 | 1] -= c[t], c[t << 1] += c[t], c[t << 1 | 1] += c[t],
        c[t] = 0;
  if (tg[t] && l != r)
    a[t << 1] = a[t], a[t << 1 | 1] = a[t], b[t << 1] = b[t],
           b[t << 1 | 1] = b[t], tg[t << 1] = 1, tg[t << 1 | 1] = 1;
  if (l == ql && r == qr) {
    if (b[t] - x <= 0) {
      if (tg[t]) {
        a[t] += x, b[t] = getdis(a[t]) - a[t];
        if (b[t] == 0) return 1;
        return 0;
      } else {
        int d = (l + r) >> 1;
        bool fl = 0;
        fl |= adds(l, d, t << 1, l, d, x);
        fl |= adds(d + 1, r, t << 1 | 1, d + 1, r, x);
        b[t] = min(b[t << 1], b[t << 1 | 1]);
        return fl;
      }
    } else {
      a[t] += x, b[t] -= x, c[t] += x;
      return 0;
    }
  }
  tg[t] = 0;
  int d = (l + r) >> 1;
  bool fl = 0;
  if (ql <= d) fl |= adds(l, d, t << 1, ql, min(d, qr), x);
  if (d + 1 <= qr) fl |= adds(d + 1, r, t << 1 | 1, max(d + 1, ql), qr, x);
  b[t] = min(b[t << 1], b[t << 1 | 1]);
  return fl;
}
int main() {
  cin >> n >> q, w[0] = 1;
  for (int i = 1; i <= 9; i++) w[i] = w[i - 1] * 42;
  for (int i = 1; i <= n; i++) f[i] = read();
  build(1, n, 1);
  while (q--) {
    int x = read();
    if (x == 1) {
      int u = read();
      printf("%lld\n", getans(1, n, 1, u));
    }
    if (x == 2) {
      int l = read(), r = read(), v = read();
      coverx(1, n, 1, l, r, v);
    }
    if (x == 3) {
      int l = read(), r = read(), v = read();
      while (adds(1, n, 1, l, r, v))
        ;
    }
  }
}
