#include #include #include #include using namespace std; typedef int ll; const int MAX_N = 10005; const ll MOD = 123456789; ll C[105][MAX_N]; ll A[MAX_N],B[MAX_N]; int len; int lowbit(int x){ return x&(-x); } void add(int x,ll value, int floor){ while(x<=len){ C[floor][x]=(C[floor][x]+value)%MOD; x+=lowbit(x); } } ll sum(int x, int floor){ ll ans=0; while(x>0){ ans=(ans+C[floor][x])%MOD; x-=lowbit(x); } return ans; } int main() { int n,m; while(scanf("%d%d",&n,&m)==2){ for(int i=0; i