#include <iostream> 
#include <cstdio> 
#include <cstdlib> 
#include <cstring> 
#include <cmath> 
#include <algorithm> 
using namespace std; 
const int Mod = 998244353; 
int fpow(int x, int y) {
	int res = 1; 
	while (y) {
		if (y & 1) res = 1ll * res * x % Mod; 
		x = 1ll * x * x % Mod; 
		y >>= 1; 
	} 
	return res; 
} 
const int MAX_N = 1e6 + 5; 
int N = 1e6, M, fac[MAX_N], ifc[MAX_N]; 
int C(int n, int m) {
	if (n < m || n < 0 || m < 0) return 0; 
	else return 1ll * fac[n] * ifc[m] % Mod * ifc[n - m] % Mod; 
} 
int main () { 
	for (int i = fac[0] = 1; i <= N; i++) fac[i] = 1ll * fac[i - 1] * i % Mod; 
	ifc[N] = fpow(fac[N], Mod - 2); 
	for (int i = N - 1; ~i; i--) ifc[i] = 1ll * ifc[i + 1] * (i + 1) % Mod; 
	cin >> N >> M; 
	if (N > M) swap(N, M); 
	int ans = 0; 
	for (int i = 1; i <= N; i++) ans = (ans + 1ll * C(i << 1, i) * C(N - i + M - i, N - i)) % Mod; 
	ans = 1ll * ans * fpow(2 * C(N + M, M) % Mod, Mod - 2) % Mod; 
	printf("%d\n", (ans + M) % Mod); 
    return 0; 
} 
#include<bits/stdc++.h>
using namespace std;
const bool DBG = 1;

#define TRACE(x)    x
#define WATCH(x)    TRACE(cout << #x" = " << x << endl)
#define WATCHR(a,b) TRACE(for(auto it=a; it!=b;) cout<<*(it++)<<" ";cout<<endl)
#define WATCHC(V)   TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})
#define all(x) (x).begin(), (x).end()

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define f first
#define s second
#define resz resize

#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)

#define sort_by(x, y) sort(all(x), [&](const auto& a, const auto& b) { return y; })

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;

using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;

using vpii = vector<pii>;
using vvpii = vector<vpii>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
using vpdd = vector<pdd>;
using vvpdd = vector<vpdd>;

template<typename T> void ckmin(T& a, const T& b) { a = min(a, b); }
template<typename T> void ckmax(T& a, const T& b) { a = max(a, b); }

void solve() {
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cout << fixed << setprecision(15);

    int n,m; cin >> n >> m;
    if(n % 2) {
        F0R(i,m) {
            cout << i+1 << " " << 2*m-i << "\n";
        }
    } else {
        int max_odd_m = m, max_even_m = m;
        if(m % 2 == 0) max_odd_m--;
        else max_even_m--;
        for(int i = 0; 2*i+1 <= m; i++) {
            cout << i+1 << " " << max_odd_m+1-i << "\n";
        }
        for(int i = 0; 2*i+2 <= m; i++) {
            cout << max_odd_m+2+i << " " << max_odd_m+2+max_even_m-i << "\n";
        }
    }

	return 0;
}
