#include <bits/stdc++.h>
using namespace std;
int gi() {
  char ch = '!';
  int res = 0, f = 0;
  while (ch < '0' || ch > '9') {
    ch = getchar();
    if (ch == '-') f = 1;
  }
  while (ch >= '0' && ch <= '9') res = res * 10 + ch - '0', ch = getchar();
  return f ? -res : res;
}
const int N = 1e5 + 7;
int n, Q, arr[N], flg[N << 2], c[N << 2];
long long mn[N << 2], tag[N << 2], pw[11];
bool update(int k, long long val) {
  for (int i = 0;; ++i)
    if (val < pw[i]) {
      c[k] = i, mn[k] = pw[i] - val;
      return (val == pw[i - 1]);
    }
}
void pushdown(int k) {
  if (flg[k]) {
    flg[(k << 1)] = flg[(k << 1 | 1)] = 1;
    mn[(k << 1)] = mn[(k << 1 | 1)] = mn[k],
             c[(k << 1)] = c[(k << 1 | 1)] = c[k];
    tag[(k << 1)] = tag[(k << 1 | 1)] = tag[k];
    flg[k] = 0, tag[k] = 0;
  }
  if (tag[k]) {
    tag[(k << 1)] += tag[k], mn[(k << 1)] += tag[k];
    tag[(k << 1 | 1)] += tag[k], mn[(k << 1 | 1)] += tag[k];
    tag[k] = 0;
  }
}
void init(int k = 1, int l = 1, int r = n) {
  if (l == r) {
    flg[k] = 1;
    update(k, arr[l]);
    return;
  }
  int mid = (l + r) >> 1;
  init((k << 1), l, mid), init((k << 1 | 1), mid + 1, r);
}
void reset(int k, int ql, int qr, int val, int l = 1, int r = n) {
  if (ql <= l && r <= qr) {
    flg[k] = 1;
    update(k, val);
    return;
  }
  int mid = (l + r) >> 1;
  pushdown(k);
  if (ql <= mid) reset((k << 1), ql, qr, val, l, mid);
  if (qr > mid) reset((k << 1 | 1), ql, qr, val, mid + 1, r);
  mn[k] = min(mn[(k << 1)], mn[(k << 1 | 1)]);
}
bool modify(int k, int ql, int qr, int val, int l = 1, int r = n) {
  if (ql <= l && r <= qr && (val < mn[k] || flg[k])) {
    mn[k] -= val, tag[k] -= val;
    return mn[k] <= 0 ? update(k, pw[c[k]] - mn[k]) : 0;
  }
  int mid = (l + r) >> 1, res = 0;
  pushdown(k);
  if (ql <= mid) res |= modify((k << 1), ql, qr, val, l, mid);
  if (qr > mid) res |= modify((k << 1 | 1), ql, qr, val, mid + 1, r);
  mn[k] = min(mn[(k << 1)], mn[(k << 1 | 1)]);
  return res;
}
long long query(int k, int tar, int l = 1, int r = n) {
  if (l == r || flg[k]) {
    return pw[c[k]] - mn[k];
  }
  int mid = (l + r) >> 1;
  pushdown(k);
  tar <= mid ? query((k << 1), tar, l, mid)
             : query((k << 1 | 1), tar, mid + 1, r);
}
int main() {
  pw[0] = 1;
  for (int i = 1; i <= 10; ++i) pw[i] = 42ll * pw[i - 1];
  n = gi(), Q = gi();
  for (int i = 1; i <= n; ++i) arr[i] = gi();
  init();
  while (Q--) {
    int op = gi();
    if (op == 1) {
      int x = gi();
      printf("%lld\n", query(1, x));
    }
    if (op == 2) {
      int l = gi(), r = gi(), x = gi();
      reset(1, l, r, x);
    }
    if (op == 3) {
      int l = gi(), r = gi(), x = gi();
      for (; modify(1, l, r, x);)
        ;
    }
  }
  return 0;
}
