#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0;
  int ch = getchar(), f = 1;
  while (!isdigit(ch) && (ch != '-') && (ch != EOF)) ch = getchar();
  if (ch == '-') {
    f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 1) + (x << 3) + ch - '0';
    ch = getchar();
  }
  return x * f;
}
const int N = 1e5 + 10;
int n, q, opt, l, r, x, a[N];
long long p[11];
struct SegMent_Tree {
  long long Min[N << 2], lazy1[N << 2], lazy2[N << 2], last[N << 2];
  inline void Get(long long &x, long long &y, long long z) {
    int now = 0;
    while (p[now] < z) ++now;
    x = now, y = p[now] - z;
  }
  inline void push_up(int u) { Min[u] = min(Min[u << 1], Min[u << 1 ^ 1]); }
  inline void Build(int u, int l, int r) {
    if (l == r) {
      Get(last[u], Min[u], a[l]);
      return;
    }
    int mid = l + r >> 1;
    Build(u << 1, l, mid), Build(u << 1 ^ 1, mid + 1, r);
    push_up(u);
  }
  inline void push_down(int u) {
    int ls = u << 1, rs = u << 1 ^ 1;
    long long x = lazy1[u], y = lazy2[u];
    if (x) {
      lazy2[ls] = lazy2[rs] = 0, lazy1[ls] = lazy1[rs] = x;
      Get(last[ls], Min[ls], x), Get(last[rs], Min[rs], x), lazy1[u] = 0;
    }
    if (y) {
      lazy1[ls] ? lazy1[ls] += y : lazy2[ls] += y;
      lazy1[rs] ? lazy1[rs] += y : lazy2[rs] += y;
      Min[ls] -= y, Min[rs] -= y, lazy2[u] = 0;
    }
  }
  inline void update(int u, int l, int r, int ql, int qr, int x, int opt) {
    if (l >= ql && r <= qr) {
      if (!opt)
        lazy1[u] = x, lazy2[u] = 0, Get(last[u], Min[u], x);
      else
        lazy1[u] ? lazy1[u] += x : lazy2[u] += x, Min[u] -= x;
      return;
    }
    int mid = l + r >> 1;
    push_down(u);
    if (qr <= mid)
      update(u << 1, l, mid, ql, qr, x, opt);
    else if (ql > mid)
      update(u << 1 ^ 1, mid + 1, r, ql, qr, x, opt);
    else
      update(u << 1, l, mid, ql, qr, x, opt),
          update(u << 1 ^ 1, mid + 1, r, ql, qr, x, opt);
    push_up(u);
  }
  inline bool check(int u, int l, int r) {
    if (Min[u] >= 0) return Min[u] == 0;
    if (l == r) {
      while (Min[u] < 0) {
        Min[u] -= p[last[u]];
        Min[u] += p[++last[u]];
      }
      return Min[u] == 0;
    }
    int mid = l + r >> 1;
    push_down(u);
    check(u << 1, l, mid), check(u << 1 ^ 1, mid + 1, r);
    push_up(u);
    return Min[u] == 0;
  }
  inline long long Query(int u, int l, int r, int ql) {
    if (l == r) return p[last[u]] - Min[u];
    int mid = l + r >> 1;
    push_down(u);
    return ql <= mid ? Query(u << 1, l, mid, ql)
                     : Query(u << 1 ^ 1, mid + 1, r, ql);
  }
} t;
int main() {
  n = read(), q = read();
  for (register int i = (1); i <= (n); i++) a[i] = read();
  p[0] = 1;
  for (register int i = (1); i <= (10); i++) p[i] = p[i - 1] * 42;
  t.Build(1, 1, n);
  while (q--) {
    opt = read();
    if (opt == 1)
      printf("%lld\n", t.Query(1, 1, n, read()));
    else if (opt == 2)
      l = read(), r = read(), x = read(), t.update(1, 1, n, l, r, x, 0);
    else {
      l = read(), r = read(), x = read(), t.update(1, 1, n, l, r, x, 1);
      while (t.check(1, 1, n)) t.update(1, 1, n, l, r, x, 1);
    }
  }
}
