#include <bits/stdc++.h>
using namespace std;
inline int gi() {
  char c = getchar();
  while (c < '0' || c > '9') c = getchar();
  int sum = 0;
  while ('0' <= c && c <= '9') sum = sum * 10 + c - 48, c = getchar();
  return sum;
}
const int maxn = 100005;
int n, m, a[maxn], deg[maxn << 2];
long long Pow[20], dis[maxn << 2], tag1[maxn << 2], tag2[maxn << 2];
int Log(long long x) { return lower_bound(Pow, Pow + 11, x) - Pow; }
void build(int s, int l, int r) {
  if (l == r) return deg[s] = Log(a[l]), dis[s] = Pow[deg[s]] - a[l], void();
  build((s << 1), l, ((l + r) >> 1));
  build((s << 1 | 1), ((l + r) >> 1) + 1, r);
  dis[s] = min(dis[(s << 1)], dis[(s << 1 | 1)]);
}
inline void cov(int s, long long v) {
  tag2[s] = 0;
  tag1[s] = v;
  deg[s] = Log(v);
  dis[s] = Pow[deg[s]] - v;
}
inline void add(int s, long long v) {
  if (tag1[s])
    tag1[s] += v;
  else
    tag2[s] += v;
  dis[s] -= v;
}
void pushdown(int s) {
  if (!tag1[s] && !tag2[s]) return;
  if (tag1[s]) cov((s << 1), tag1[s]), cov((s << 1 | 1), tag1[s]), tag1[s] = 0;
  if (tag2[s]) add((s << 1), tag2[s]), add((s << 1 | 1), tag2[s]), tag2[s] = 0;
}
void cover(int s, int l, int r, int ql, int qr, int w) {
  if (ql <= l && r <= qr) return cov(s, w);
  pushdown(s);
  if (ql <= ((l + r) >> 1)) cover((s << 1), l, ((l + r) >> 1), ql, qr, w);
  if (qr >= ((l + r) >> 1) + 1)
    cover((s << 1 | 1), ((l + r) >> 1) + 1, r, ql, qr, w);
  dis[s] = min(dis[(s << 1)], dis[(s << 1 | 1)]);
}
void insert(int s, int l, int r, int ql, int qr, int w) {
  if (ql <= l && r <= qr) return add(s, w);
  pushdown(s);
  if (ql <= ((l + r) >> 1)) insert((s << 1), l, ((l + r) >> 1), ql, qr, w);
  if (qr >= ((l + r) >> 1) + 1)
    insert((s << 1 | 1), ((l + r) >> 1) + 1, r, ql, qr, w);
  dis[s] = min(dis[(s << 1)], dis[(s << 1 | 1)]);
}
long long query(int s, int l, int r, int p) {
  if (l == r) return Pow[deg[s]] - dis[s];
  pushdown(s);
  if (p <= ((l + r) >> 1))
    return query((s << 1), l, ((l + r) >> 1), p);
  else
    return query((s << 1 | 1), ((l + r) >> 1) + 1, r, p);
}
int query(int s, int l, int r) {
  if (dis[s] >= 0) return dis[s];
  if (l == r) {
    long long x = Pow[deg[s]] - dis[s];
    deg[s] = Log(x);
    dis[s] = Pow[deg[s]] - x;
    return dis[s];
  }
  pushdown(s);
  query((s << 1), l, ((l + r) >> 1));
  query((s << 1 | 1), ((l + r) >> 1) + 1, r);
  return dis[s] = min(dis[(s << 1)], dis[(s << 1 | 1)]);
}
int main() {
  double p = 1;
  for (int i = 0; p * 42 <= 1e18; p *= 42, ++i) Pow[i] = p;
  n = gi();
  m = gi();
  for (int i = 1; i <= n; ++i) a[i] = gi();
  build(1, 1, n);
  for (int op, x, y, a, i = 1; i <= m; ++i) {
    op = gi();
    if (op == 1)
      printf("%lld\n", query(1, 1, n, gi()));
    else if (op == 2)
      x = gi(), y = gi(), cover(1, 1, n, x, y, gi());
    else {
      x = gi();
      y = gi();
      a = gi();
      do insert(1, 1, n, x, y, a);
      while (!query(1, 1, n));
    }
  }
  return 0;
}
