#include <bits/stdc++.h>   using namespace std;   const int N = 1e4 + 1, M = 100;   int n, q;   bitset<N> sq[M];   vector<int> on[N];   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> n >> q;     for (int x = 0, qwerty = M; x < qwerty; x++) sq[x][0] = 1;     for (int x = 0, qwerty = q; x < qwerty; x++) {       int l, r, v;       cin >> l >> r >> v;       l--;       r--;       if (l / M == r / M) {         for (int i = l; i <= r; i++) on[i].push_back(v);         continue;       }       for (int i = (l / M) + 1; i < r / M; i++) {         sq[i] |= (sq[i] << v);       }       for (int i = l; i < M * ((l / M) + 1); i++) on[i].push_back(v);       for (int i = M * (r / M); i <= r; i++) on[i].push_back(v);     }     bitset<N> ans;     for (int x = 0, qwerty = n; x < qwerty; x++) {       int pos = x / M;       bitset<N> tmp = sq[pos];       for (int v : on[x]) tmp |= tmp << v;       ans |= tmp;     }     vector<int> aa;     for (int x = 1, qwerty = n + 1; x < qwerty; x++)       if (ans[x]) aa.push_back(x);     cout << ((int)(aa).size()) <<   n ;     for (int x = 0, qwerty = ((int)(aa).size()); x < qwerty; x++)       cout << aa[x] <<    n [x + 1 == ((int)(aa).size())];   }   