#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n, m, l, r, x;
bool p;
long long b[15], a[N];
struct item {
  long long mn, lazy;
  int step;
  bool ob;
};
item t[4 * N];
inline void mrg(int v) {
  if (t[v + v].mn < t[v + v + 1].mn) {
    t[v].mn = t[v + v].mn;
    t[v].step = t[v + v].step;
  } else {
    t[v].mn = t[v + v + 1].mn;
    t[v].step = t[v + v + 1].step;
  }
}
inline void push(int v) {
  if (t[v].ob) {
    t[v + v].ob = t[v + v + 1].ob = 1;
    t[v + v].step = t[v + v + 1].step = t[v].step;
    t[v + v + 1].mn = t[v + v].mn = t[v].mn;
    t[v].ob = t[v].lazy = t[v + v].lazy = t[v + v + 1].lazy = 0;
    return;
  }
  t[v + v].lazy += t[v].lazy;
  t[v + v + 1].lazy += t[v].lazy;
  t[v + v].mn -= t[v].lazy;
  t[v + v + 1].mn -= t[v].lazy;
  t[v].lazy = 0;
}
void build(int v, int l, int r) {
  if (l == r) {
    t[v].step = lower_bound(b + 1, b + 10, a[l]) - b;
    t[v].mn = b[t[v].step] - a[l];
    t[v].ob = true;
    return;
  }
  int mid = (r + l) >> 1;
  build(v + v, l, mid);
  build(v + v + 1, mid + 1, r);
  mrg(v);
}
void upd(int v, int l, int r, int tl, int tr, int x) {
  if (l > r || l > tr || tl > r) {
    return;
  }
  if (tl <= l && r <= tr) {
    t[v].step = lower_bound(b + 1, b + 10, x) - b;
    t[v].mn = b[t[v].step] - x;
    t[v].lazy = 0;
    t[v].ob = true;
    return;
  }
  push(v);
  int mid = (r + l) >> 1;
  upd(v + v, l, mid, tl, tr, x);
  upd(v + v + 1, mid + 1, r, tl, tr, x);
  mrg(v);
}
long long get(int v, int l, int r, int pos) {
  if (l == r) {
    return b[t[v].step] - t[v].mn;
  }
  push(v);
  int mid = (r + l) >> 1;
  if (pos <= mid) {
    return get(v + v, l, mid, pos);
  } else {
    return get(v + v + 1, mid + 1, r, pos);
  }
}
void add(int v, int l, int r, int tl, int tr, int x) {
  if (l > r || l > tr || tl > r) {
    return;
  }
  if (tl <= l && r <= tr && x < t[v].mn) {
    t[v].mn -= x;
    t[v].lazy += x;
    return;
  }
  if (tl <= l && r <= tr && t[v].ob) {
    t[v].mn -= x;
    while (t[v].mn < 0) {
      t[v].mn += b[t[v].step + 1] - b[t[v].step];
      t[v].step++;
    }
    if (t[v].mn == 0) {
      t[v].mn += b[t[v].step + 1] - b[t[v].step];
      t[v].step++;
      p = true;
    }
    return;
  }
  push(v);
  int mid = (r + l) >> 1;
  add(v + v, l, mid, tl, tr, x);
  add(v + v + 1, mid + 1, r, tl, tr, x);
  mrg(v);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  b[0] = 1;
  for (int i = 1; i <= 10; i++) {
    b[i] = b[i - 1] * 42;
  }
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  build(1, 1, n);
  for (int i = 1; i <= m; i++) {
    int type;
    cin >> type;
    if (type == 1) {
      cin >> x;
      cout << get(1, 1, n, x) << "\n";
    } else if (type == 2) {
      cin >> l >> r >> x;
      upd(1, 1, n, l, r, x);
    } else {
      cin >> l >> r >> x;
      while (true) {
        p = false;
        add(1, 1, n, l, r, x);
        if (!p) {
          break;
        }
      }
    }
  }
}
