#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void read(T &x) {
  int f = 0;
  x = 0;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar()) f |= (ch == '-');
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
  if (f) x = -x;
}
const int N = 400005;
long long t[N], v[N], u[N], mn[N], bad[50];
int cnt, n, Q, op, l, r, a, b;
inline long long getmn(long long x) {
  int t = lower_bound(bad + 1, bad + cnt + 1, x) - bad;
  return bad[t] - x;
}
void build(int o, int l, int r) {
  if (l == r) {
    v[o] = t[l];
    mn[o] = getmn(v[o]);
    return;
  }
  build((o << 1), l, ((l + r) >> 1)),
      build((o << 1 | 1), ((l + r) >> 1) + 1, r);
  mn[o] = min(mn[(o << 1)], mn[(o << 1 | 1)]);
}
void down(int o) {
  if (v[o]) {
    v[(o << 1)] = v[o], mn[(o << 1)] = mn[o], u[(o << 1)] = 0;
    v[(o << 1 | 1)] = v[o], mn[(o << 1 | 1)] = mn[o], u[(o << 1 | 1)] = 0;
    v[o] = u[o] = 0;
  } else if (u[o]) {
    if (v[(o << 1)]) v[(o << 1)] += u[o];
    mn[(o << 1)] -= u[o], u[(o << 1)] += u[o];
    assert(mn[(o << 1)] > 0);
    if (v[(o << 1 | 1)]) v[(o << 1 | 1)] += u[o];
    mn[(o << 1 | 1)] -= u[o], u[(o << 1 | 1)] += u[o];
    assert(mn[(o << 1 | 1)] > 0);
    u[o] = 0;
  }
}
long long getval(int o, int l, int r, int x) {
  if (l == r) return v[o];
  down(o);
  if (x <= ((l + r) >> 1)) return getval((o << 1), l, ((l + r) >> 1), x);
  return getval((o << 1 | 1), ((l + r) >> 1) + 1, r, x);
}
void cover(int o, int l, int r, int x, int y, int z) {
  if (l == x && y == r) {
    v[o] = z, u[o] = 0;
    mn[o] = getmn(v[o]);
    return;
  }
  down(o);
  if (x <= ((l + r) >> 1))
    cover((o << 1), l, ((l + r) >> 1), x, min(y, ((l + r) >> 1)), z);
  if (((l + r) >> 1) < y)
    cover((o << 1 | 1), ((l + r) >> 1) + 1, r, max(((l + r) >> 1) + 1, x), y,
          z);
  mn[o] = min(mn[(o << 1)], mn[(o << 1 | 1)]);
}
bool add(int o, int l, int r, int x, int y, int z) {
  if (l == x && y == r && v[o]) {
    v[o] += z, u[o] = 0;
    mn[o] = getmn(v[o]);
    return mn[o] == 0;
  }
  if (l == x && y == r && mn[o] > z) {
    mn[o] -= z, u[o] += z;
    return 0;
  }
  int ret = 0;
  down(o);
  if (x <= ((l + r) >> 1))
    ret |= add((o << 1), l, ((l + r) >> 1), x, min(y, ((l + r) >> 1)), z);
  if (((l + r) >> 1) < y)
    ret |= add((o << 1 | 1), ((l + r) >> 1) + 1, r, max(((l + r) >> 1) + 1, x),
               y, z);
  mn[o] = min(mn[(o << 1)], mn[(o << 1 | 1)]);
  return ret;
}
int main() {
  bad[cnt = 1] = 1;
  while (bad[cnt] < 1e15) bad[cnt + 1] = bad[cnt] * 42, cnt++;
  read(n), read(Q);
  for (int i = (1); i <= (n); i++) read(t[i]);
  build(1, 1, n);
  while (Q--) {
    read(op);
    if (op == 1) {
      read(a);
      printf("%lld\n", getval(1, 1, n, a));
    } else if (op == 2) {
      read(l), read(r), read(a);
      cover(1, 1, n, l, r, a);
    } else {
      read(l), read(r), read(a);
      while (add(1, 1, n, l, r, a))
        ;
    }
  }
  return 0;
}
