#include <bits/stdc++.h>
using namespace std;
const int DEBUG = 0;
namespace defs {
template <class Type>
Type read() {
  Type aa;
  int bb = 1, ch;
  while (ch = getchar(), (ch < '0' || ch > '9') && ch != '-')
    ;
  ch == '-' ? aa = 0, bb = -1 : aa = ch - '0';
  while (ch = getchar(), ch >= '0' && ch <= '9') aa = aa * 10 + ch - '0';
  return bb == 1 ? aa : -aa;
}
const unsigned int rand_x = 1401010315;
const unsigned int rand_y = 1000000019;
unsigned int rand_cur;
unsigned int rand_int() { return rand_cur = rand_cur * rand_x + rand_y; }
const int inf = 1071026353;
const int mod = 1000000007;
const int modx = 998244353;
}  // namespace defs
namespace st {
long long pw[11] = {1,
                    42,
                    1764,
                    74088,
                    3111696ll,
                    130691232ll,
                    5489031744ll,
                    230539333248ll,
                    9682651996416ll,
                    406671383849472ll,
                    17080198121677824ll};
long long val[100010];
struct cnode {
  long long key, set, add;
  int now;
};
cnode node[400040];
void build(int i, int l, int r) {
  node[i].set = node[i].add = 0;
  if (l < r) {
    int mid = l + r >> 1;
    build(i << 1, l, mid), build(i << 1 | 1, mid + 1, r);
    node[i].key =
        ((node[i << 1].key) < (node[i << 1 | 1].key) ? (node[i << 1].key)
                                                     : (node[i << 1 | 1].key));
  } else {
    int now = 0;
    while (pw[now] < val[l]) ++now;
    node[i].now = now;
    node[i].key = pw[now] - val[l];
  }
}
void setlazy(int i, long long k) {
  node[i].add = 0;
  int now = 0;
  while (pw[now] < k) ++now;
  node[i].now = now;
  node[i].key = pw[now] - k;
  node[i].set = k;
}
void addlazy(int i, long long k) {
  if (node[i].set)
    node[i].set += k;
  else
    node[i].add += k;
  node[i].key -= k;
}
void pushdown(int i) {
  if (node[i].set) {
    setlazy(i << 1, node[i].set);
    setlazy(i << 1 | 1, node[i].set);
    node[i].set = 0;
  }
  if (node[i].add) {
    addlazy(i << 1, node[i].add);
    addlazy(i << 1 | 1, node[i].add);
    node[i].add = 0;
  }
}
void modify(int i, int l, int r, int ml, int mr, int k, int opt) {
  if (ml <= l && mr >= r) {
    if (opt == 2) setlazy(i, k);
    if (opt == 3) addlazy(i, k);
    return;
  }
  pushdown(i);
  int mid = l + r >> 1;
  if (ml <= mid) modify(i << 1, l, mid, ml, mr, k, opt);
  if (mr > mid) modify(i << 1 | 1, mid + 1, r, ml, mr, k, opt);
  node[i].key =
      ((node[i << 1].key) < (node[i << 1 | 1].key) ? (node[i << 1].key)
                                                   : (node[i << 1 | 1].key));
}
bool fix(int i, int l, int r) {
  if (node[i].key >= 0) {
    return node[i].key == 0;
  }
  if (l == r) {
    while (node[i].key < 0) {
      node[i].key -= pw[node[i].now];
      node[i].key += pw[++node[i].now];
    }
    return node[i].key == 0;
  }
  pushdown(i);
  int mid = l + r >> 1;
  fix(i << 1, l, mid), fix(i << 1 | 1, mid + 1, r);
  node[i].key =
      ((node[i << 1].key) < (node[i << 1 | 1].key) ? (node[i << 1].key)
                                                   : (node[i << 1 | 1].key));
  return node[i].key == 0;
}
long long query(int i, int l, int r, int p) {
  if (l == r) {
    return pw[node[i].now] - node[i].key;
  }
  pushdown(i);
  int mid = l + r >> 1;
  if (p <= mid) {
    return query(i << 1, l, mid, p);
  } else {
    return query(i << 1 | 1, mid + 1, r, p);
  }
}
}  // namespace st
namespace lightningwork {
int (*read)() = defs::read<int>;
int n, m;
void work() {
  n = read();
  m = read();
  for (int i = 1; i <= n; ++i) {
    st::val[i] = read();
  }
  st::build(1, 1, n);
  for (int i = 1; i <= m; ++i) {
    int opt = read();
    if (opt == 1) {
      printf("%lld\n", st::query(1, 1, n, read()));
    } else if (opt == 2) {
      int l = read();
      int r = read();
      int k = read();
      st::modify(1, 1, n, l, r, k, 2);
    } else {
      int l = read();
      int r = read();
      int k = read();
      st::modify(1, 1, n, l, r, k, 3);
      while (st::fix(1, 1, n)) {
        st::modify(1, 1, n, l, r, k, 3);
      }
    }
  }
}
}  // namespace lightningwork
int main() {
  if (0)
    freopen(
        "work"
        ".in",
        "r", stdin),
        freopen(
            "work"
            ".out",
            "w", stdout);
  lightningwork::work();
  if (0) fclose(stdin), fclose(stdout);
  return 0;
}
