#include <bits/stdc++.h>
#pragma GCC optimize("O2")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2,fma")
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const long long maxn = 1e5 + 10;
const long long mod = 1e9 + 7;
const long double PI = acos((long double)-1);
long long pw(long long a, long long b, long long md = mod) {
  long long res = 1;
  while (b) {
    if (b & 1) {
      res = (a * res) % md;
    }
    a = (a * a) % md;
    b >>= 1;
  }
  return (res);
}
vector<long long> p42;
long long n, q;
long long a[maxn];
long long nxt(long long x) {
  return (*lower_bound(p42.begin(), p42.end(), x) - x);
}
struct node {
  long long a, mx, mn;
  friend node operator+(node a, node &b) {
    if (b.a != a.a) a.a = 0;
    a.mn = min(a.mn, b.mn);
    a.mx = max(a.mx, b.mx);
    return (a);
  }
};
node seg[maxn * 4];
void build(long long v = 1, long long l = 1, long long r = n + 1) {
  if (r - l == 1) {
    seg[v] = {a[l], nxt(a[l]), nxt(a[l])};
    return;
  }
  build((v << 1), l, ((l + r) >> 1));
  build(((v << 1) | 1), ((l + r) >> 1), r);
  seg[v] = seg[(v << 1)] + seg[((v << 1) | 1)];
}
long long lazy[maxn * 4];
void shift(long long v, long long l, long long r) {
  if (lazy[v] > 0) {
    seg[v].a = lazy[v];
    seg[v].mn = seg[v].mx = nxt(seg[v].a);
  } else {
    if (seg[v].a)
      seg[v].a -= lazy[v], seg[v].mn = seg[v].mx = nxt(seg[v].a);
    else
      seg[v].mn += lazy[v], seg[v].mx += lazy[v];
  }
  if (r - l > 1) {
    if (lazy[v] > 0)
      lazy[(v << 1)] = lazy[((v << 1) | 1)] = lazy[v];
    else
      lazy[(v << 1)] += ((lazy[(v << 1)] > 0) ? -lazy[v] : lazy[v]),
          lazy[((v << 1) | 1)] +=
          ((lazy[((v << 1) | 1)] > 0) ? -lazy[v] : lazy[v]);
  }
  lazy[v] = 0;
}
long long get(long long x, long long v = 1, long long l = 1,
              long long r = n + 1) {
  for (; r - l > 1;) {
    shift(v, l, r);
    if (x < ((l + r) >> 1))
      r = ((l + r) >> 1), v = (v << 1);
    else
      l = ((l + r) >> 1), v = ((v << 1) | 1);
  }
  shift(v, l, r);
  return (seg[v].a);
}
void update(long long L, long long R, long long x, long long v = 1,
            long long l = 1, long long r = n + 1) {
  shift(v, l, r);
  if (r <= L or R <= l) return;
  if (L <= l and r <= R) {
    lazy[v] = x;
    shift(v, l, r);
    return;
  }
  update(L, R, x, (v << 1), l, ((l + r) >> 1));
  update(L, R, x, ((v << 1) | 1), ((l + r) >> 1), r);
  seg[v] = seg[(v << 1)] + seg[((v << 1) | 1)];
}
void fisht(long long v, long long l, long long r) {
  if (seg[v].a or seg[v].mn + lazy[v] >= 0) {
    shift(v, l, r);
    return;
  }
  lazy[(v << 1)] += lazy[v], lazy[((v << 1) | 1)] += lazy[v];
  fisht((v << 1), l, ((l + r) >> 1));
  fisht(((v << 1) | 1), ((l + r) >> 1), r);
  seg[v] = seg[(v << 1)] + seg[((v << 1) | 1)];
  lazy[v] = 0;
}
void add(long long L, long long R, long long x, long long v = 1,
         long long l = 1, long long r = n + 1) {
  shift(v, l, r);
  if (r <= L or R <= l) return;
  if (L <= l and r <= R) {
    lazy[v] = -x;
    fisht(v, l, r);
    return;
  }
  add(L, R, x, (v << 1), l, ((l + r) >> 1));
  add(L, R, x, ((v << 1) | 1), ((l + r) >> 1), r);
  seg[v] = seg[(v << 1)] + seg[((v << 1) | 1)];
}
int32_t main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  p42.push_back(1);
  while (p42.back() < 1e16) p42.push_back(p42.back() * 42);
  cin >> n >> q;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  build();
  while (q--) {
    long long t;
    cin >> t;
    if (t == 1) {
      long long x;
      cin >> x;
      cout << get(x) << '\n';
    }
    if (t == 2) {
      long long l, r, x;
      cin >> l >> r >> x;
      update(l, r + 1, x);
    }
    if (t == 3) {
      long long l, r, x;
      cin >> l >> r >> x;
      add(l, r + 1, x);
      while (seg[1].mn <= 0) add(l, r + 1, x);
    }
  }
  return (0);
}
