#include <bits/stdc++.h>
using namespace std;
long long n, q, shu[100005];
long long mc[13] = {
    1,         42,         1764,         74088,         3111696,
    130691232, 5489031744, 230539333248, 9682651996416, 406671383849472};
struct node {
  long long flag, x, y, lz;
} tt[500005];
long long find(long long aa) { return *lower_bound(mc + 1, mc + 11, aa); }
void up(long long rt) {
  if (tt[rt << 1].y < tt[rt << 1 | 1].y) {
    tt[rt].x = tt[rt << 1].x;
    tt[rt].y = tt[rt << 1].y;
  } else {
    tt[rt].x = tt[rt << 1 | 1].x;
    tt[rt].y = tt[rt << 1 | 1].y;
  }
  return;
}
void pushdown(long long rt) {
  if (tt[rt].flag) {
    tt[rt].lz = 0;
    tt[rt << 1] = tt[rt << 1 | 1] = tt[rt];
    tt[rt].flag = 0;
  }
  if (tt[rt].lz) {
    tt[rt << 1].x += tt[rt].lz;
    tt[rt << 1 | 1].x += tt[rt].lz;
    tt[rt << 1].lz += tt[rt].lz;
    tt[rt << 1 | 1].lz += tt[rt].lz;
    tt[rt << 1].y = find(tt[rt << 1].x) - tt[rt << 1].x;
    tt[rt << 1 | 1].y = find(tt[rt << 1 | 1].x) - tt[rt << 1 | 1].x;
    tt[rt].lz = 0;
  }
  return;
}
long long query(long long rt, long long ll, long long rr, long long dd) {
  if (tt[rt].flag) {
    return tt[rt].x;
  }
  long long mid = (ll + rr) >> 1;
  pushdown(rt);
  long long ans;
  if (dd <= mid)
    ans = query(rt << 1, ll, mid, dd);
  else
    ans = query(rt << 1 | 1, mid + 1, rr, dd);
  up(rt);
  return ans;
}
void bt(long long rt, long long ll, long long rr) {
  if (ll == rr) {
    tt[rt].flag = 1;
    tt[rt].x = shu[ll];
    tt[rt].y = find(shu[ll]) - shu[ll];
    tt[rt].lz = 0;
    return;
  }
  long long mid = (ll + rr) >> 1;
  bt(rt << 1, ll, mid);
  bt(rt << 1 | 1, mid + 1, rr);
  up(rt);
  return;
}
void change1(long long rt, long long ll, long long rr, long long L, long long R,
             long long kk) {
  if (ll > R || rr < L) return;
  if (ll >= L && rr <= R) {
    tt[rt].flag = 1;
    tt[rt].x = kk;
    tt[rt].y = find(kk) - kk;
    tt[rt].lz = 0;
    return;
  }
  long long mid = (ll + rr) >> 1;
  pushdown(rt);
  change1(rt << 1, ll, mid, L, R, kk);
  change1(rt << 1 | 1, mid + 1, rr, L, R, kk);
  up(rt);
  return;
}
bool change2(long long rt, long long ll, long long rr, long long L, long long R,
             long long kk) {
  if (ll > R || rr < L) return false;
  if ((tt[rt].flag || tt[rt].y > kk) && ll >= L && rr <= R) {
    tt[rt].lz += kk;
    tt[rt].x += kk;
    tt[rt].y = find(tt[rt].x) - tt[rt].x;
    if (!tt[rt].y)
      return true;
    else
      return false;
  }
  long long mid = (ll + rr) >> 1;
  pushdown(rt);
  bool aa = change2(rt << 1, ll, mid, L, R, kk);
  bool bb = change2(rt << 1 | 1, mid + 1, rr, L, R, kk);
  up(rt);
  return aa || bb;
}
int main() {
  scanf("%lld%lld", &n, &q);
  for (long long i = 1; i <= n; ++i) {
    scanf("%lld", &shu[i]);
  }
  bt(1, 1, n);
  while (q--) {
    long long flag;
    scanf("%lld", &flag);
    if (flag == 1) {
      long long x;
      scanf("%lld", &x);
      printf("%lld\n", query(1, 1, n, x));
    } else if (flag == 2) {
      long long x, y, z;
      scanf("%lld%lld%lld", &x, &y, &z);
      change1(1, 1, n, x, y, z);
    } else if (flag == 3) {
      long long x, y, z;
      scanf("%lld%lld%lld", &x, &y, &z);
      while (change2(1, 1, n, x, y, z))
        ;
    }
  }
  return 0;
}
