#include <bits/stdc++.h>
using namespace std;
bool debug = 0;
int n, m, k;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
string direc = "RDLU";
long long ln, lk, lm;
void etp(bool f = 0) {
  puts(f ? "Yes" : "No");
  exit(0);
}
void addmod(int &x, int y, int mod = 1000000007) {
  x += y;
  if (x >= mod) x -= mod;
}
void et() {
  puts("-1");
  exit(0);
}
int t[100005];
long long t42[20];
long long val[100005 * 4], mn[100005 * 4], lz[100005 * 4];
bool fg[100005 * 4];
bool cal(long long x, long long &a, long long &b) {
  for (int(i) = 0; (i) < (int)(11); (i)++)
    if (x < t42[i]) {
      a = t42[i];
      b = t42[i] - x;
      return x == t42[i - 1];
    }
  return 0;
}
void up(int rt) { mn[rt] = min(mn[(rt << 1)], mn[(rt << 1 | 1)]); }
void down(int rt, int l, int r) {
  if (fg[rt] && l + 1 < r) {
    fg[(rt << 1)] = 1;
    val[(rt << 1)] = val[rt];
    mn[(rt << 1)] = mn[rt];
    fg[(rt << 1 | 1)] = 1;
    val[(rt << 1 | 1)] = val[rt];
    mn[(rt << 1 | 1)] = mn[rt];
    fg[rt] = 0;
    lz[rt] = 0;
  }
  if (lz[rt] && l + 1 < r) {
    lz[(rt << 1)] += lz[rt];
    lz[(rt << 1 | 1)] += lz[rt];
    mn[(rt << 1)] -= lz[rt];
    mn[(rt << 1 | 1)] -= lz[rt];
    assert(mn[(rt << 1)] >= 0);
    lz[rt] = 0;
  }
}
void build(int rt, int l, int r) {
  if (l + 1 == r) {
    cal(t[r], val[rt], mn[rt]);
    fg[rt] = 1;
    return;
  }
  int mid = (l + r) / 2;
  build((rt << 1), l, mid);
  build((rt << 1 | 1), mid, r);
  up(rt);
}
void setS(int rt, int l, int r, int L, int R, long long v) {
  if (r <= L || R <= l) return;
  if (L <= l && r <= R) {
    fg[rt] = 1;
    cal(v, val[rt], mn[rt]);
    return;
  }
  down(rt, l, r);
  int mid = (l + r) / 2;
  setS((rt << 1), l, mid, L, R, v);
  setS((rt << 1 | 1), mid, r, L, R, v);
  up(rt);
}
bool upt(int rt, int l, int r, int L, int R, long long v) {
  if (r <= L || R <= l) return 0;
  bool ans = 0;
  if (L <= l && r <= R) {
    if ((v < mn[rt]) || fg[rt]) {
      lz[rt] += v;
      mn[rt] -= v;
      if (mn[rt] <= 0) ans = cal(val[rt] - mn[rt], val[rt], mn[rt]);
      return ans;
    }
  }
  down(rt, l, r);
  int mid = (l + r) / 2;
  ans |= upt((rt << 1), l, mid, L, R, v);
  ans |= upt((rt << 1 | 1), mid, r, L, R, v);
  up(rt);
  return ans;
}
long long qy(int rt, int l, int r, int pos) {
  if (l + 1 == r) return val[rt] - mn[rt];
  down(rt, l, r);
  int mid = (l + r) / 2;
  if (pos <= mid)
    return qy((rt << 1), l, mid, pos);
  else
    return qy((rt << 1 | 1), mid, r, pos);
}
void fmain() {
  scanf("%d%d", &n, &m);
  for (int(i) = 1; (i) <= (int)(n); (i)++) scanf("%d", t + i);
  t42[0] = 1;
  for (int(i) = 1; (i) <= (int)(10); (i)++) t42[i] = t42[i - 1] * 42;
  build(1, 0, n);
  for (int i = 0, ty, a, b, x; i < m; i++) {
    scanf("%d", &ty);
    if (ty == 1) {
      scanf("%d", &x);
      printf("%lld\n", qy(1, 0, n, x));
    } else {
      scanf("%d%d%d", &a, &b, &x);
      if (ty == 2)
        setS(1, 0, n, a - 1, b, x);
      else {
        while (upt(1, 0, n, a - 1, b, x))
          ;
      }
    }
  }
}
int main() {
  fmain();
  return 0;
}
