#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int n, m, a[N];
long long pw[10];
struct st {
  long long mn, tg1, tg2, lvl;
} T[N << 2];
inline int lvl(long long x) {
  for (int i = 0; i < 10; i++)
    if (pw[i] >= x) return i;
}
inline long long dis(long long x) {
  for (int i = 0; i < 10; i++)
    if (pw[i] >= x) return pw[i] - x;
}
inline void up(int x) { T[x].mn = min(T[x << 1].mn, T[x << 1 | 1].mn); }
inline void uplvl(int x) {
  long long d = pw[T[x].lvl] - T[x].mn;
  T[x].lvl = lvl(d);
  T[x].mn = dis(d);
}
void dn(int x, int l, int r) {
  if (T[x].tg1 > 0) {
    if (l != r) {
      T[x << 1] = T[x << 1 | 1] =
          (st){dis(T[x].tg1), T[x].tg1, 0, lvl(T[x].tg1)};
    }
    T[x].tg1 = 0;
  }
  if (T[x].tg2 > 0) {
    if (l != r) {
      T[x << 1].mn -= T[x].tg2;
      T[x << 1 | 1].mn -= T[x].tg2;
      T[x << 1].tg2 += T[x].tg2;
      T[x << 1 | 1].tg2 += T[x].tg2;
    }
    T[x].tg2 = 0;
  }
}
void build(int x, int l, int r) {
  if (l == r) {
    T[x].lvl = lvl(a[l]);
    T[x].mn = dis(a[l]);
    T[x].tg1 = -1;
    T[x].tg2 = 0;
    return;
  }
  int mid = l + r >> 1;
  T[x].tg1 = -1;
  T[x].tg2 = 0;
  build(x << 1, l, mid);
  build(x << 1 | 1, mid + 1, r);
  up(x);
}
void chg(int x, int l, int r, int tl, int tr, int v, int o) {
  int mid = l + r >> 1;
  dn(x, l, r);
  if (tl <= l && r <= tr) {
    if (o == 1)
      T[x].tg1 = v, T[x].lvl = lvl(v), T[x].mn = dis(v);
    else
      T[x].tg2 = v, T[x].mn -= v;
    return;
  }
  T[x].tg1 = -1;
  if (tl <= mid) chg(x << 1, l, mid, tl, tr, v, o);
  if (tr > mid) chg(x << 1 | 1, mid + 1, r, tl, tr, v, o);
  up(x);
}
void upd(int x, int l, int r) {
  dn(x, l, r);
  if (l == r || !T[x].tg1) {
    uplvl(x);
    return;
  }
  int mid = l + r >> 1;
  if (T[x << 1].mn < 0) upd(x << 1, l, mid);
  if (T[x << 1 | 1].mn < 0) upd(x << 1 | 1, mid + 1, r);
  up(x);
}
long long qry(int x, int l, int r, int p) {
  dn(x, l, r);
  if (l == r || !T[x].tg1) return pw[T[x].lvl] - T[x].mn;
  int mid = l + r >> 1;
  return p <= mid ? qry(x << 1, l, mid, p) : qry(x << 1 | 1, mid + 1, r, p);
}
int main() {
  for (int i = pw[0] = 1; i <= 9; i++) pw[i] = 42ll * pw[i - 1];
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  build(1, 1, n);
  while (m--) {
    int o, l, r, x;
    scanf("%d", &o);
    if (o == 1) {
      scanf("%d", &x);
      printf("%lld\n", qry(1, 1, n, x));
      continue;
    }
    scanf("%d%d%d", &l, &r, &x);
    if (o == 2) {
      chg(1, 1, n, l, r, x, 1);
      continue;
    }
    do {
      chg(1, 1, n, l, r, x, 2);
      if (T[1].mn < 0) upd(1, 1, n);
    } while (!T[1].mn);
  }
  return 0;
}
