#include <bits/stdc++.h>
const int N = 300054;
int n, q;
long long K, B, tot;
std::pair<long long, long long> a[N];
inline void reset() {
  K = B = 0, n = 1, *a = std::pair<long long, long long>(0, 0);
}
inline bool fy(const std::pair<long long, long long> &u,
               const std::pair<long long, long long> &v, long long K) {
  return u.first - v.first <= (long double)K * (v.second - u.second);
}
inline bool fy(const std::pair<long long, long long> &u,
               const std::pair<long long, long long> &v,
               const std::pair<long long, long long> &w) {
  return (long double)(u.first - v.first) * (w.second - v.second) <=
         (long double)(v.first - w.first) * (v.second - u.second);
}
inline void push(const std::pair<long long, long long> &t) {
  for (; n > 1 && fy(a[n - 2], a[n - 1], t); --n)
    ;
  a[n++] = t;
}
inline void adjust(long long K) {
  for (; n > 1 && fy(a[n - 2], a[n - 1], K); --n)
    ;
}
int main() {
  int op, k, d;
  reset();
  for (scanf("%lld%d", &tot, &q); q;
       adjust(K),
       printf("%lld %lld\n", a[n - 1].second + 1,
              a[n - 1].second * K + B + a[n - 1].first),
       --q)
    switch (scanf("%d%d", &op, &k), op) {
      case 1:
        reset(), tot += k;
        break;
      case 2:
        push(std::pair<long long, long long>(-K * tot - B, tot)), tot += k;
        break;
      case 3:
        scanf("%d", &d), B += k, K += d;
        break;
    }
  return 0;
}
