#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool ylmin(T &a, T b) {
  return a < b ? 0 : (a = b, 1);
}
template <class T>
inline bool ylmax(T &a, T b) {
  return a > b ? 0 : (a = b, 1);
}
template <class T>
inline T abs(T x) {
  return x < 0 ? -x : x;
}
inline char read() {
  static const int IO_LEN = 1024 * 1024;
  static char buf[IO_LEN], *ioh, *iot;
  if (ioh == iot) {
    iot = (ioh = buf) + fread(buf, 1, IO_LEN, stdin);
    if (ioh == iot) return -1;
  }
  return *ioh++;
}
template <class T>
inline void read(T &x) {
  static int iosig;
  static char ioc;
  for (iosig = 0, ioc = read(); !isdigit(ioc); ioc = read())
    if (ioc == '-') iosig = 1;
  for (x = 0; isdigit(ioc); ioc = read()) x = (x << 1) + (x << 3) + (ioc ^ '0');
  if (iosig) x = -x;
}
const int MAXN = 1e5 + 10;
int n, q, opt, l, r, x, a[MAXN];
struct Node {
  long long S[15];
  inline void init() {
    long long nw = 1;
    S[0] = nw;
    for (int i = (1); i <= (11); i++) nw *= 42, S[i] = nw;
  }
  inline long long val(long long x) { return *lower_bound(S, S + 12, x) - x; }
} hlt;
struct Segment {
  long long Min[MAXN << 2], tag1[MAXN << 2], tag2[MAXN << 2];
  inline void pushup(int rt) { Min[rt] = min(Min[rt << 1], Min[rt << 1 | 1]); }
  inline void pushdown(int rt) {
    if (tag1[rt]) {
      tag1[rt << 1] = tag1[rt << 1 | 1] = tag1[rt];
      Min[rt << 1] = Min[rt << 1 | 1] = hlt.val(tag1[rt]);
      tag2[rt << 1] = tag2[rt << 1 | 1] = tag1[rt] = 0;
    }
    if (tag2[rt]) {
      if (tag1[rt << 1])
        tag1[rt << 1] += tag2[rt];
      else
        tag2[rt << 1] += tag2[rt];
      if (tag1[rt << 1 | 1])
        tag1[rt << 1 | 1] += tag2[rt];
      else
        tag2[rt << 1 | 1] += tag2[rt];
      Min[rt << 1] -= tag2[rt], Min[rt << 1 | 1] -= tag2[rt];
      tag2[rt] = 0;
    }
  }
  inline void build(int rt, int l, int r) {
    if (l == r) {
      Min[rt] = hlt.val(a[l]);
      tag2[rt] = a[l];
      return;
    }
    int mid = l + r >> 1;
    build(rt << 1, l, mid), build(rt << 1 | 1, mid + 1, r);
    pushup(rt);
  }
  inline void cover(int rt, int l, int r, int L, int R, long long k) {
    if (l >= L && r <= R) {
      Min[rt] = hlt.val(k);
      tag1[rt] = k;
      tag2[rt] = 0;
      return;
    }
    int mid = l + r >> 1;
    pushdown(rt);
    if (R <= mid)
      cover(rt << 1, l, mid, L, R, k);
    else if (L > mid)
      cover(rt << 1 | 1, mid + 1, r, L, R, k);
    else
      cover(rt << 1, l, mid, L, R, k), cover(rt << 1 | 1, mid + 1, r, L, R, k);
    pushup(rt);
  }
  inline void add(int rt, int l, int r, int L, int R, long long k) {
    if (l >= L && r <= R) {
      if (tag1[rt])
        tag1[rt] += k;
      else
        tag2[rt] += k;
      Min[rt] -= k;
      return;
    }
    int mid = l + r >> 1;
    pushdown(rt);
    if (R <= mid)
      add(rt << 1, l, mid, L, R, k);
    else if (L > mid)
      add(rt << 1 | 1, mid + 1, r, L, R, k);
    else
      add(rt << 1, l, mid, L, R, k), add(rt << 1 | 1, mid + 1, r, L, R, k);
    pushup(rt);
  }
  inline bool check(int rt, int l, int r) {
    if (Min[rt] >= 0) return Min[rt] == 0;
    if (l == r) {
      Min[rt] = hlt.val(tag1[rt] + tag2[rt]);
      return Min[rt] == 0;
    }
    int mid = l + r >> 1;
    pushdown(rt);
    check(rt << 1, l, mid), check(rt << 1 | 1, mid + 1, r);
    pushup(rt);
    return Min[rt] == 0;
  }
  inline long long query(int rt, int l, int r, int pos) {
    if (l == r) return tag1[rt] + tag2[rt];
    int mid = l + r >> 1;
    pushdown(rt);
    if (pos <= mid)
      return query(rt << 1, l, mid, pos);
    else
      return query(rt << 1 | 1, mid + 1, r, pos);
  }
} mjy;
int main() {
  read(n), read(q);
  for (int i = (1); i <= (n); i++) read(a[i]);
  hlt.init(), mjy.build(1, 1, n);
  for (int i = (1); i <= (q); i++) {
    read(opt);
    if (opt == 1)
      read(x), printf("%lld\n", mjy.query(1, 1, n, x));
    else if (opt == 2) {
      read(l), read(r), read(x);
      mjy.cover(1, 1, n, l, r, x);
    } else if (opt == 3) {
      read(l), read(r), read(x);
      do mjy.add(1, 1, n, l, r, x);
      while (mjy.check(1, 1, n));
    }
  }
  return 0;
}
