#include <bits/stdc++.h>
using namespace std;
struct node {
  long long minn;
  int p, min_ind;
  node(long long a = 0, int b = 0, int c = 0) { minn = a, p = b, min_ind = c; }
};
struct lazy_node {
  long long sv, snx, av, anx;
  lazy_node(long long a = -1, int b = 0, long long c = 0, int d = 0) {
    sv = a, snx = b;
    av = c, anx = d;
  }
};
const int max_N = 100000 + 10;
const int X = 1e8;
int a[max_N], n;
set<pair<int, int> > s;
set<pair<int, int> >::iterator it, itt;
long long pw42[15];
node seg[4 * max_N];
lazy_node lazy[4 * max_N];
inline int find_pw(long long x) {
  return lower_bound(pw42, pw42 + 12, x) - pw42;
}
inline node merge(int ind) {
  if (seg[2 * ind].minn < seg[2 * ind + 1].minn) return seg[2 * ind];
  return seg[2 * ind + 1];
}
inline void split1(int l, int r) {
  it = s.upper_bound(make_pair(l, X)), itt = s.upper_bound(make_pair(r, X));
  it--, itt--;
  pair<int, int> t = make_pair((it->first), (itt->second));
  while (it != s.end() && (it->first) <= r) {
    s.erase(it);
    it = s.lower_bound(make_pair(l, X));
  }
  s.insert(make_pair(l, r));
  if (l > t.first) s.insert(make_pair(t.first, l - 1));
  if (r < t.second) s.insert(make_pair(r + 1, t.second));
}
inline void split2(int l, int r) {
  it = s.upper_bound(make_pair(l, X));
  itt = s.upper_bound(make_pair(r, X));
  pair<int, int> t1 = *(--it), t2 = *(--itt);
  s.erase(it);
  if (t1 != t2) {
    itt = s.upper_bound(make_pair(r, X));
    s.erase(--itt);
  }
  if (l > t1.first) s.insert(make_pair(t1.first, l - 1));
  if (r < t2.second) s.insert(make_pair(r + 1, t2.second));
  s.insert(make_pair(l, min(r, t1.second)));
  s.insert(make_pair(max(l, t2.first), r));
}
void build(int st = 0, int en = n, int ind = 1) {
  if (en - st == 1) {
    int t = find_pw(a[st]);
    seg[ind] = node(pw42[t] - a[st], t, st);
    return;
  }
  int mid = (st + en) / 2;
  build(st, mid, 2 * ind);
  build(mid, en, 2 * ind + 1);
  seg[ind] = merge(ind);
}
inline void shift(int ind) {
  lazy_node t = lazy[ind];
  lazy[ind] = lazy_node();
  int i1 = 2 * ind, i2 = 2 * ind + 1;
  if (t.sv != -1) {
    seg[i1] = node(t.sv, t.snx, seg[i1].min_ind);
    seg[i2] = node(t.sv, t.snx, seg[i2].min_ind);
    lazy[i1] = lazy_node(t.sv, t.snx);
    lazy[i2] = lazy_node(t.sv, t.snx);
  }
  seg[i1].minn -= t.av, seg[i2].minn -= t.av;
  seg[i1].p += t.anx, seg[i2].p += t.anx;
  lazy[i1].av += t.av, lazy[i2].av += t.av;
  lazy[i1].anx += t.anx, lazy[i2].anx += t.anx;
}
void modify1(int l, int r, long long val, int nx, int st = 0, int en = n,
             int ind = 1) {
  if (l >= en || r <= st) return;
  if (l <= st && r >= en) {
    seg[ind] = node(val, nx, st);
    lazy[ind] = lazy_node(val, nx);
    return;
  }
  shift(ind);
  int mid = (st + en) / 2;
  modify1(l, r, val, nx, st, mid, 2 * ind);
  modify1(l, r, val, nx, mid, en, 2 * ind + 1);
  seg[ind] = merge(ind);
}
void modify2(int o, int l, int r, long long val, int st = 0, int en = n,
             int ind = 1) {
  if (l >= en || r <= st) return;
  if (l <= st && r >= en) {
    seg[ind].minn -= val, seg[ind].p += o;
    lazy[ind].av += val, lazy[ind].anx += o;
    return;
  }
  shift(ind);
  int mid = (st + en) / 2;
  modify2(o, l, r, val, st, mid, 2 * ind);
  modify2(o, l, r, val, mid, en, 2 * ind + 1);
  seg[ind] = merge(ind);
}
inline void relax() {
  while (seg[1].minn < 0) {
    int x = seg[1].p;
    it = s.upper_bound(make_pair(seg[1].min_ind, X));
    pair<int, int> t = *(--it);
    modify2(1, t.first, t.second + 1, pw42[x] - pw42[x + 1]);
  }
}
long long calc(int x, int st = 0, int en = n, int ind = 1) {
  if (en - st == 1) return pw42[seg[ind].p] - seg[ind].minn;
  shift(ind);
  int mid = (st + en) / 2;
  if (x < mid) return calc(x, st, mid, 2 * ind);
  return calc(x, mid, en, 2 * ind + 1);
}
int main() {
  int q, l, r, x, t;
  scanf("%d %d", &n, &q);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    s.insert(make_pair(i, i));
  }
  pw42[0] = 1;
  for (int i = 1; i < 12; i++) pw42[i] = pw42[i - 1] * 42;
  build();
  while (q--) {
    scanf("%d", &t);
    if (t == 1) {
      scanf("%d", &x);
      printf("%lld\n", calc(x - 1));
    } else {
      scanf("%d %d %d", &l, &r, &x);
      l--;
      if (t == 2) {
        int nx = find_pw(x);
        modify1(l, r, pw42[nx] - x, nx);
        split1(l, r - 1);
      } else {
        split2(l, r - 1);
        do {
          modify2(0, l, r, x);
          relax();
        } while (!seg[1].minn);
      }
    }
  }
  return 0;
}
