#include <bits/stdc++.h>
inline int rd() {
  int x;
  scanf("%d", &x);
  return x;
}
const int N = 2e6 + 233;
int n, q;
long long val[N];
inline int get_ver(long long x) {
  for (int i = 0; i <= 10; ++i)
    if (val[i] >= x) return i;
  return -1;
}
long long A[N], B[N], C[N], D[N];
inline void push1(int p, long long a, int b) {
  A[p] = B[p] = a, C[p] = b, D[p] = 0;
}
inline void push2(int p, long long a) {
  if (C[p]) {
    B[p] -= a;
    while (B[p] < 0) B[p] += val[C[p] + 1] - val[C[p]], ++C[p];
    A[p] = B[p];
  } else {
    A[p] -= a, D[p] += a;
  }
}
inline void pushdown(int p) {
  if (B[p]) {
    push1((p << 1), B[p], C[p]);
    push1(((p << 1) | 1), B[p], C[p]);
    B[p] = C[p] = 0;
  }
  if (D[p]) {
    push2((p << 1), D[p]);
    push2(((p << 1) | 1), D[p]);
    D[p] = 0;
  }
}
inline void pushup(int p) { A[p] = std::min(A[(p << 1)], A[((p << 1) | 1)]); }
void modify(int p, int l, int r, int a, long long b, int L, int R) {
  if (l <= L && r >= R) return push1(p, b, a);
  pushdown(p);
  if (l <= ((L + R) >> 1)) modify((p << 1), l, r, a, b, L, ((L + R) >> 1));
  if (r > ((L + R) >> 1))
    modify(((p << 1) | 1), l, r, a, b, ((L + R) >> 1) + 1, R);
  pushup(p);
}
long long add(int p, int l, int r, long long v, int L, int R) {
  if (l <= L && r >= R)
    if (A[p] >= v || C[p]) return push2(p, v), A[p];
  pushdown(p);
  if (l <= ((L + R) >> 1)) add((p << 1), l, r, v, L, ((L + R) >> 1));
  if (r > ((L + R) >> 1)) add(((p << 1) | 1), l, r, v, ((L + R) >> 1) + 1, R);
  pushup(p);
  return A[p];
}
long long query(int p, int x, int L, int R) {
  if (L == R) return val[C[p]] - B[p];
  pushdown(p);
  if (x <= ((L + R) >> 1))
    return query((p << 1), x, L, ((L + R) >> 1));
  else
    return query(((p << 1) | 1), x, ((L + R) >> 1) + 1, R);
}
int main() {
  val[0] = 1;
  for (int i = 1; i <= 10; ++i) val[i] = val[i - 1] * 42;
  n = rd(), q = rd();
  for (int i = 1; i <= n; ++i) {
    int x = rd();
    modify(1, i, i, get_ver(x), val[get_ver(x)] - x, 1, n);
  }
  while (q--) {
    int op = rd();
    if (op == 1) {
      printf("%lld\n", query(1, rd(), 1, n));
    } else if (op == 2) {
      int l = rd(), r = rd(), x = rd();
      modify(1, l, r, get_ver(x), val[get_ver(x)] - x, 1, n);
    } else {
      int l = rd(), r = rd(), x = rd();
      while (!add(1, l, r, x, 1, n))
        ;
    }
  }
  return 0;
}
