import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class E {

	static long mod=998244353;
	static long[] facts, factInvs;

	public static void main(String[] args) {
		precomp();
		FastScanner fs=new FastScanner();
		try {
		int n=fs.nextInt(), k=fs.nextInt();
		if (k==0) {
			System.out.println(facts[n]);
			return;
		}
		if (k>=n) {
			System.out.println(0);
			return;
		}
		int nUsable=n-k;
		long assignWays=powGo(nUsable, n);
		long pickThese=nCk(n, nUsable);
		long ways=mul(assignWays, pickThese);
		System.out.println(mul(ways, 2));
		}
		catch(Throwable t) {
			System.out.println(0);
		}
	}

	static long powGo(int base, long exp) {
		long ans=0;
		for (int sub=0; sub<base; sub++) {
			long delta=fastPow(base-sub, exp)*nCk(base, sub);
			if (sub%2==0) {
				ans=add(ans, delta);
			}
			else {
				ans=sub(ans, delta);
			}
		}
		return ans;
	}

	static void precomp() {
		facts=new long[1_000_000];
		factInvs=new long[1_000_000];
		facts[0]=factInvs[0]=1;
		for (int i=1; i<facts.length; i++) facts[i]=mul(facts[i-1], i);
		factInvs[facts.length-1]=fastPow(facts[facts.length-1], mod-2);
		for (int i=factInvs.length-2; i>=0; i--) factInvs[i]=mul(factInvs[i+1], i+1);
	}

	static long nCk(int n, int k) {
		long ans=mul(facts[n], mul(factInvs[k], factInvs[n-k]));
		return ans;
	}

	static long add(long a, long b) {
		return (a+b)%mod;
	}

	static long sub(long a, long b) {
		return ((a-b)%mod+mod)%mod;
	}

	static long mul(long a, long b) {
		return a*b%mod;
	}

	static long fastPow(long base, long exp) {
		if (exp==0) return 1;
		long half=fastPow(base, exp/2);
		if (exp%2==0) return mul(half, half);
		return mul(half, mul(half, base));
	}

	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");

		public String next() {
			while (!st.hasMoreElements())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) {
				a[i]=nextInt();
			}
			return a;
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

	}

}


import java.io.*;
import java.util.*;

public class Main {
	static void solve() {
		int n = ni();
		long tmp = nl();
		if(n <= tmp) {
			out.println(0);
			return;
		}
		int k = (int)tmp;
		preFact(400000);
		long ans = 0;
		int si = 1;
		long t = cmb(n, n-k);
		for(int i=n-k;i>=1;i--) {
			ans += si * cmb(n-k, i) * pow(i, n);
			ans %= mod;
			if(ans < 0)ans += mod;
			si *= -1;
		}
		ans *= t; ans %= mod;
		if(k!=0)ans *= 2; ans %= mod;
		if(ans < 0) ans += mod;
		out.println(ans);
	}

	//Fast Fermat Combination
	static long fact[];
	static long revFact[];

	static void preFact(int n) {
		fact = new long[n + 1];
		revFact = new long[n + 1];
		fact[0] = 1;
		for (int i = 0; i < n; i++) {
			fact[i + 1] = mul(i + 1, fact[i]);
		}
		revFact[n] = div(1, fact[n]);
		for (int i = n - 1; i >= 0; i--) {
			revFact[i] = mul(revFact[i + 1], i + 1);
		}
	}

	static long cmb(int a, int b) {
		if (a<b)return 0;
		if (fact.length == 0)
			System.err.println("error : factorials has not been culculated!! do [pre_factorial] method");
		long af = fact[a];
		long bf = revFact[b];
		long abf = revFact[a - b];
		long res = mul(mul(af, bf), abf);
		return res;
	}

	//constant
	static final int inf = Integer.MAX_VALUE / 2;
	static final long linf = Long.MAX_VALUE / 3;
	static final double dinf = Double.MAX_VALUE / 3;
	static final long mod = (long) 998244353;
	static final int[] dx = { -1, 0, 1, 0 }, dy = { 0, -1, 0, 1 }, dx8 = { -1, -1, -1, 0, 0, 1, 1, 1 }, dy8 = { -1, 0, 1, -1, 1, -1, 0, 1 };
	static final double eps = 1e-10, pi = Math.PI;
	static StringBuilder sb = new StringBuilder();

	//libraries
	static void reverse(int ar[]) {
		int len = ar.length;
		for (int i = 0; i < len / 2; i++) {
			int t = ar[i];
			ar[i] = ar[len - 1 - i];
			ar[len - 1 - i] = t;
		}
	}
	static void reverse(long ar[]) {
		int len = ar.length;
		for (int i = 0; i < len / 2; i++) {
			long t = ar[i];
			ar[i] = ar[len - 1 - i];
			ar[len - 1 - i] = t;
		}
	}
	static void reverse(double ar[]) {
		int len = ar.length;
		for (int i = 0; i < len / 2; i++) {
			double t = ar[i];
			ar[i] = ar[len - 1 - i];
			ar[len - 1 - i] = t;
		}
	}
	static void reverse(char ar[]) {
		int len = ar.length;
		for (int i = 0; i < len / 2; i++) {
			char t = ar[i];
			ar[i] = ar[len - 1 - i];
			ar[len - 1 - i] = t;
		}
	}
	static String getReverse(String s) {
		char c[] = s.toCharArray();
		reverse(c);
		s = String.valueOf(c);
		return s;
	}
	static <T> void reverse(List<T> ls) {
		int sz = ls.size();
		for (int i = 0; i < sz / 2; i++) {
			T t = ls.get(i);
			ls.set(i, ls.get(sz - 1 - i));
			ls.set(sz - 1 - i, t);
		}
	}
	static <T> void reverse(T[] ar) {
		int len = ar.length;
		for (int i = 0; i < len / 2; i++) {
			T t = ar[i];
			ar[i] = ar[len - 1 - i];
			ar[len - 1 - i] = t;
		}
	}
	static void sbnl() {//StringBuilderに改行文字をappendする
		sb.append("\n");
	}
	static int lowerBound(int[] a, int x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] < x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}
	static int upperBound(int[] a, int x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] <= x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}
	static int rlowerBound(int[] a, int x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] > x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}
	static int rupperBound(int[] a, int x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] >= x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}
	static int lowerBound(long[] a, long x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] < x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}
	static int upperBound(long[] a, long x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] <= x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}
	static int rlowerBound(long[] a, long x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] > x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}
	static int rupperBound(long[] a, long x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] >= x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}
	static int lowerBound(double[] a, double x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] < x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}
	static int upperBound(double[] a, double x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] <= x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}
	static int rlowerBound(double[] a, double x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] > x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}
	static int rupperBound(double[] a, double x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] >= x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}
	static int lowerBound(char[] a, char x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] < x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}
	static int upperBound(char[] a, char x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] <= x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}
	static int rlowerBound(char[] a, char x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] > x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}
	static int rupperBound(char[] a, char x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] >= x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}
	static <T> int lowerBound(List<T> ls, T x) throws RuntimeException {
		if (ls.size() == 0)
			return -1;
		if (ls.get(0) instanceof Integer) {
			return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) >= 0 ? 1 : -1);
		} else if (ls.get(0) instanceof Long) {
			return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) >= 0 ? 1 : -1);
		} else if (ls.get(0) instanceof Double) {
			return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) >= 0 ? 1 : -1);
		} else {
			System.err.println(
					String.format("%s:数値でないリストを二分探索しています。", Thread.currentThread().getStackTrace()[1].getMethodName()));
			throw new RuntimeException();
		}
	}
	static <T> int upperBound(List<T> ls, T x) throws RuntimeException {
		if (ls.size() == 0)
			return -1;
		if (ls.get(0) instanceof Integer) {
			return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) > 0 ? 1 : -1);
		} else if (ls.get(0) instanceof Long) {
			return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) > 0 ? 1 : -1);
		} else if (ls.get(0) instanceof Double) {
			return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) > 0 ? 1 : -1);
		} else {
			System.err.println(
					String.format("%s:数値でないリストを二分探索しています。", Thread.currentThread().getStackTrace()[1].getMethodName()));
			throw new RuntimeException();
		}
	}
	static <T> int rupperBound(List<T> ls, T x) throws RuntimeException {
		if (ls.size() == 0)
			return -1;
		if (ls.get(0) instanceof Integer) {
			return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) < 0 ? 1 : -1);
		} else if (ls.get(0) instanceof Long) {
			return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) < 0 ? 1 : -1);
		} else if (ls.get(0) instanceof Double) {
			return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) < 0 ? 1 : -1);
		} else {
			System.err.println(
					String.format("%s:数値でないリストを二分探索しています。", Thread.currentThread().getStackTrace()[1].getMethodName()));
			throw new RuntimeException();
		}
	}
	static <T> int rlowerBound(List<T> ls, T x) {
		if (ls.size() == 0)
			return -1;
		if (ls.get(0) instanceof Integer) {
			return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) <= 0 ? 1 : -1);
		} else if (ls.get(0) instanceof Long) {
			return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) <= 0 ? 1 : -1);
		} else if (ls.get(0) instanceof Double) {
			return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) <= 0 ? 1 : -1);
		} else {
			System.err.println(
					String.format("%s:数値でないリストを二分探索しています。", Thread.currentThread().getStackTrace()[1].getMethodName()));
			throw new RuntimeException();
		}
	}
	static int[] concat(int x, int arr[]) {
		int ret[] = new int[arr.length + 1];
		System.arraycopy(arr, 0, ret, 1, ret.length - 1);
		ret[0] = x;
		return ret;
	}
	static int[] concat(int arr[], int x) {
		int ret[] = new int[arr.length + 1];
		System.arraycopy(arr, 0, ret, 0, ret.length - 1);
		ret[ret.length - 1] = x;
		return ret;
	}
	static long[] concat(long x, long arr[]) {
		long ret[] = new long[arr.length + 1];
		System.arraycopy(arr, 0, ret, 1, ret.length - 1);
		ret[0] = x;
		return ret;
	}
	static long[] concat(long arr[], long x) {
		long ret[] = new long[arr.length + 1];
		System.arraycopy(arr, 0, ret, 0, ret.length - 1);
		ret[ret.length - 1] = x;
		return ret;
	}
	static char[] concat(char x, char arr[]) {
		char ret[] = new char[arr.length + 1];
		System.arraycopy(arr, 0, ret, 0, ret.length - 1);
		ret[ret.length - 1] = x;
		return ret;
	}
	static char[] concat(char arr[], char x) {
		char ret[] = new char[arr.length + 1];
		System.arraycopy(arr, 0, ret, 0, ret.length - 1);
		ret[ret.length - 1] = x;
		return ret;
	}
	static int max(int x, int y) {
		return Math.max(x, y);
	}
	static int min(int x, int y) {
		return Math.min(x, y);
	}
	static int max(int x, int y, int z) {
		x = Math.max(x, y);
		x = Math.max(x, z);
		return x;
	}
	static int min(int x, int y, int z) {
		x = Math.min(x, y);
		x = Math.min(x, z);
		return x;
	}
	static long max(long x, long y) {
		return Math.max(x, y);
	}
	static long min(long x, long y) {
		return Math.min(x, y);
	}
	static long max(long x, long y, long z) {
		x = Math.max(x, y);
		x = Math.max(x, z);
		return x;
	}
	static long min(long x, long y, long z) {
		x = Math.min(x, y);
		x = Math.min(x, z);
		return x;
	}
	static double max(double x, double y) {
		return Math.max(x, y);
	}
	static double min(double x, double y) {
		return Math.min(x, y);
	}
	static double max(double x, double y, double z) {
		x = Math.max(x, y);
		x = Math.max(x, z);
		return x;
	}
	static double min(double x, double y, double z) {
		x = Math.min(x, y);
		x = Math.min(x, z);
		return x;
	}
	static void sort(int[] ar) {
		Arrays.sort(ar);
	}
	static void sort(long[] ar) {
		Arrays.sort(ar);
	}
	static void sort(double[] ar) {
		Arrays.sort(ar);
	}
	static void sort(char[] ar) {
		Arrays.sort(ar);
	}
	static void rsort(int[] ar) {
		Arrays.sort(ar);
		int len = ar.length;
		for (int i = 0; i < len / 2; i++) {
			int tmp = ar[i];
			ar[i] = ar[len - 1 - i];
			ar[len - 1 - i] = tmp;
		}
	}
	static void rsort(long[] ar) {
		Arrays.sort(ar);
		int len = ar.length;
		for (int i = 0; i < len / 2; i++) {
			long tmp = ar[i];
			ar[i] = ar[len - 1 - i];
			ar[len - 1 - i] = tmp;
		}
	}
	static void rsort(double[] ar) {
		Arrays.sort(ar);
		int len = ar.length;
		for (int i = 0; i < len / 2; i++) {
			double tmp = ar[i];
			ar[i] = ar[len - 1 - i];
			ar[len - 1 - i] = tmp;
		}
	}
	static void rsort(char[] ar) {
		Arrays.sort(ar);
		int len = ar.length;
		for (int i = 0; i < len / 2; i++) {
			char tmp = ar[i];
			ar[i] = ar[len - 1 - i];
			ar[len - 1 - i] = tmp;
		}
	}
	static void fill(int arr[], int x) {
		Arrays.fill(arr, x);
	}
	static void fill(long arr[], long x) {
		Arrays.fill(arr, x);
	}
	static void fill(boolean arr[], boolean x) {
		Arrays.fill(arr, x);
	}
	static void fill(double arr[], double x) {
		Arrays.fill(arr, x);
	}
	static void fill(int arr[][], int x) {
		for (int i = 0; i < arr.length; i++)
			Arrays.fill(arr[i], x);
	}
	static void fill(long arr[][], long x) {
		for (int i = 0; i < arr.length; i++)
			Arrays.fill(arr[i], x);
	}
	static void fill(double arr[][], double x) {
		for (int i = 0; i < arr.length; i++)
			Arrays.fill(arr[i], x);
	}
	static void fill(boolean arr[][], boolean x) {
		for (int i = 0; i < arr.length; i++)
			Arrays.fill(arr[i], x);
	}
	//MOD culc
	static long plus(long x, long y) {
		long res = (x + y) % mod;
		return res < 0 ? res + mod : res;
	}
	static long sub(long x, long y) {
		long res = (x - y) % mod;
		return res < 0 ? res + mod : res;
	}
	static long mul(long x, long y) {
		long res = (x * y) % mod;
		return res < 0 ? res + mod : res;
	}
	static long div(long x, long y) {
		long res = x * pow(y, mod - 2) % mod;
		return res < 0 ? res + mod : res;
	}
	static long pow(long x, long y) {
		if (y < 0)
			return 0;
		if (y == 0)
			return 1;
		if (y % 2 == 1)
			return (x * pow(x, y - 1)) % mod;
		long root = pow(x, y / 2);
		return root * root % mod;
	}
	public static void main(String[] args) throws Exception {
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);
		solve();
		out.flush();
	}
	//input
	static InputStream is;
	static PrintWriter out;
	static String INPUT = "";
	private static byte[] inbuf = new byte[1024];
	static int lenbuf = 0, ptrbuf = 0;
	private static int readByte() {
		if (lenbuf == -1)
			throw new InputMismatchException();
		if (ptrbuf >= lenbuf) {
			ptrbuf = 0;
			try {
				lenbuf = is.read(inbuf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (lenbuf <= 0)
				return -1;
		}
		return inbuf[ptrbuf++];
	}
	private static boolean isSpaceChar(int c) {
		return !(c >= 33 && c <= 126);
	}
	private static int skip() {
		int b;
		while ((b = readByte()) != -1 && isSpaceChar(b))
			;
		return b;
	}
	@SuppressWarnings("unused")
	private static double nd() {
		return Double.parseDouble(ns());
	}
	@SuppressWarnings("unused")
	private static char nc() {
		return (char) skip();
	}
	private static String ns() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!(isSpaceChar(b))) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	private static char[] ns(int n) {
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while (p < n && !(isSpaceChar(b))) {
			buf[p++] = (char) b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}
	@SuppressWarnings("unused")
	private static char[][] nm(int n, int m) {
		char[][] map = new char[n][];
		for (int i = 0; i < n; i++)
			map[i] = ns(m);
		return map;
	}
	@SuppressWarnings("unused")
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	@SuppressWarnings("unused")
	private static long[] nla(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
	private static int ni() {
		int num = 0, b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}
	@SuppressWarnings("unused")
	private static long nl() {
		long num = 0;
		int b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}
}


import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class e_e86 {

	static int MOD = 998244353;
	static long fact [];

	public static void main(String[] args) throws Exception {
		// TODO Auto-generated method stub

		FastScanner in = new FastScanner(System.in);
		OutputStream outputStream = System.out;
		PrintWriter out = new PrintWriter(outputStream);

		int N = in.nextInt();
		long pk = in.nextLong();
		if(pk > N-1) {
			out.println(0);
		}else {
			int k = (int) pk;
			fact = new long [N+1];

			fact[0] = 1;
			for(int i = 1; i <= N; i++) {
				fact[i] = (i*fact[i-1])%MOD;
			}

			long ans = 0;
			int dir = 1;
			int c = N-k;
			for(int i = c; i >= 0; i--) {
				long dif = (choose(c, i)*power(i, N))%MOD;
				dif = dir*dif;
				ans = (ans + dif + MOD)%MOD;

		//		out.println(dir*(((choose(c, i))*power(i, N) + MOD)%MOD + MOD)%MOD +" " + choose(c, i) + " " + power(i, N));
				dir = -dir;
			}

			ans = (ans*choose(N, c))%MOD;
			if(k > 0) {
				ans = (2*ans)%MOD;
			}

			out.println(ans);
		}

		out.close();

	}

	static long choose(int a, int b) {
		long res = (fact[a] * inv((fact[b] * fact[a-b])%MOD))%MOD;
		return res;
	}

	static long power (long x, int y) {
		long res = 1;
		while(y > 0) {
			if(y%2 == 1) res = (res*x)%MOD;
			x = (x*x)%MOD;
			y /= 2;
		}
		return (res%MOD);
	}

	static long inv (long a) {
		return power(a, MOD-2);
	}

	static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(InputStream stream) {
			br = new BufferedReader(new InputStreamReader(stream));
			st = new StringTokenizer("");
		}

		public FastScanner(String fileName) throws Exception {
			br = new BufferedReader(new FileReader(new File(fileName)));
			st = new StringTokenizer("");
		}

		public String next() throws Exception {
			while (!st.hasMoreTokens()) {
				st = new StringTokenizer(br.readLine());
			}
			return st.nextToken();
		}

		public int nextInt() throws Exception {
			return Integer.parseInt(next());
		}

		public long nextLong() throws Exception {
			return Long.parseLong(next());
		}

		public Double nextDouble() throws Exception {
			return Double.parseDouble(next());
		}

		public String nextLine() throws Exception {
			if (st.hasMoreTokens()) {
				StringBuilder str = new StringBuilder();
				boolean first = true;
				while (st.hasMoreTokens()) {
					if (first) {
						first = false;
					} else {
						str.append(" ");
					}
					str.append(st.nextToken());
				}
				return str.toString();
			} else {
				return br.readLine();
			}
		}
	}

}


import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;

public class COVID {

	static ArrayList<Integer>[] adjList;

	static int[] fac;
	static int mod=998244353;

	static int pow(int b,long e, int mod) {
		int ans=1;
		b%=mod;
		while(e>0) {
			if((e&1)==1)
				ans=(int)((ans*1l*b)%mod);
			e>>=1;
			b=(int)((b*1l*b)%mod);
		}
		return ans;
	}
	static long ncr(int n , int r ) {
		long ans=fac[n];
		long de=((fac[n-r]*1l*fac[r])%mod);
		de=pow((int)de, mod-2, mod);
		return (ans*de)%mod;
	}

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw =new PrintWriter(System.out);
		int n=sc.nextInt();
		long k=sc.nextLong();
		if(k>n-1) {
			pw.println(0);
			pw.flush();
			return;
		}
		fac=new int[n+1];
		fac[0]=1;
		for(int i=1;i<fac.length;i++)
			fac[i]=(int)((fac[i-1]*1l*(i%mod))%mod);

		int pop=n-(int)k;
		long ans=0;
		for(int i=0;i<=pop;i++) {
			long notPop= (ncr(pop,i)*pow(pop-i,n,mod))%mod;
			if(notPop<0) {
				System.out.println("here");

			}
			if(i%2==1)notPop*=-1;
			ans+=(notPop+mod);
			ans%=mod;
		}
		ans*=ncr(n,pop);
		ans%=mod;
		if(k!=0)
			ans=ans*2%mod;
		pw.println(ans);
		pw.flush();
		pw.close();
	}
	static long gcd(long a, long b) {
		return (b==0)?a:gcd(b,a%b);
	}
	static long lcm(long a, long b) {
		return a/gcd(a,b)*b;
	}
	public static int log(int n , int base) {
		int ans=0;
		while(n+1>base) {
			ans++;
			n/=base;
		}
		return ans;
	}
	static long square(long l) {
		return l*l;
	}

	static class Pair implements Comparable<Pair>{
		int  x;int y;

		public Pair(int a,int b) {
			this.x=a;y=b;
		}

		public int compareTo(Pair o) {
			return (x==o.x)?((y>o.y)?1:(y==o.y)?0:-1):((x>o.x)?1:-1);
		}

		@Override

		public int hashCode() {
			final int prime = 31;
			int result = 1;
			result = prime * result + x;
			result = prime * result + y;
			return result;
		}

		@Override
		public boolean equals(Object obj) {
			if (this == obj)
				return true;
			if (obj == null)
				return false;
			if (getClass() != obj.getClass())
				return false;
			Pair other = (Pair) obj;
			if (x != other.x)
				return false;
			if (y != other.y)
				return false;
			return true;
		}

	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}
		public Scanner(String s) throws FileNotFoundException{	br = new BufferedReader(new FileReader(s));}

		public long[] nextLongArr(int n) throws IOException {
			long[] arr=new long[n];
			for(int i=0;i<n;i++)
				arr[i]=nextLong();
			return arr;
		}
		public int[] nextIntArr(int n) throws IOException {
			int[] arr=new int[n];
			for(int i=0;i<n;i++)
				arr[i]=nextInt();
			return arr;
		}
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine()," ,");
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if (x.charAt(0) == '-') {
				neg = true;
				start++;
			}
			for (int i = start; i < x.length(); i++) {
				if (x.charAt(i) == '.') {
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				} else {
					sb.append(x.charAt(i));
					if (dec)
						f *= 10;
				}
				if (sb.length() == 18) {
					res += Long.parseLong(sb.toString()) / f;
					sb = new StringBuilder("0");
				}
			}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg ? -1 : 1);
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

	}

	public static void shuffle(int[] a) {
		int n = a.length;
		for (int i = 0; i < n; i++) {
			int r = i + (int) (Math.random() * (n - i));
			int tmp = a[i];
			a[i] = a[r];
			a[r] = tmp;
		}
	}
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        EPlacingRooks solver = new EPlacingRooks();
        solver.solve(1, in, out);
        out.close();
    }

    static class EPlacingRooks {
        NumberTheory.Mod998 mod = new NumberTheory.Mod998();

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            long k = in.nextLong();
            if (k == 0) {
                out.println(mod.fact(n));
                return;
            }

            if (k > n - 1) {
                out.println(0);
                return;
            }

            // This is the number of columns that are non-empty.
            int c = (int) (n - k);

            long answer = 0;
            for (int i = 1; i <= c; i++) {
                // i is the number of allowable columns to put things
                long term = mod.mult(mod.paritySign(c - i), mod.ncr(c, i), mod.pow(i, n));
                answer = mod.add(answer, term);
            }

            // Multiply by 2 C(n, c) because we want to pick c rows or c columns.
            answer = mod.mult(answer, 2, mod.ncr(n, c));

            out.println(answer);
        }

    }

    static class NumberTheory {
        private static void ASSERT(boolean assertion) {
            if (!assertion)
                throw new AssertionError();
        }

        public abstract static class Modulus<M extends NumberTheory.Modulus<M>> {
            final ArrayList<Long> factorial = new ArrayList<>();
            final ArrayList<Long> invFactorial = new ArrayList<>();

            public abstract long modulus();

            public Modulus() {
                super();
                factorial.add(1L);
                invFactorial.add(1L);
            }

            public long fact(int n) {
                while (factorial.size() <= n) {
                    factorial.add(mult(factorial.get(factorial.size() - 1), factorial.size()));
                }

                return factorial.get(n);
            }

            public long fInv(int n) {
                int lastKnown = invFactorial.size() - 1;

                if (lastKnown < n) {
                    long[] fInv = new long[n - lastKnown];
                    fInv[0] = inv(fact(n));
                    for (int i = 1; i < fInv.length; i++) {
                        fInv[i] = mult(fInv[i - 1], n - i + 1);
                    }
                    for (int i = fInv.length - 1; i >= 0; i--) {
                        invFactorial.add(fInv[i]);
                    }
                }

                return invFactorial.get(n);
            }

            public long paritySign(long k) {
                return (k & 1) == 0 ? 1 : modulus() - 1;
            }

            public long ncr(int n, int r) {
                ASSERT(n >= 0);
                if (r < 0 || n < r)
                    return 0;
                return mult(fact(n), mult(fInv(r), fInv(n - r)));
            }

            public long normalize(long x) {
                x %= modulus();
                if (x < 0)
                    x += modulus();
                return x;
            }

            public long add(long a, long b) {
                long v = a + b;
                return v < modulus() ? v : v - modulus();
            }

            public long mult(long... x) {
                long r = 1;
                for (long i : x)
                    r = mult(r, i);
                return r;
            }

            public long mult(long a, long b) {
                return (a * b) % modulus();
            }

            public long pow(long x, int e) {
                if (e < 0) {
                    x = inv(x);
                    e *= -1;
                }
                if (e == 0)
                    return 1;
                if ((e & 1) > 0)
                    return mult(x, pow(x, e - 1));
                return pow(mult(x, x), e / 2);
            }

            public long inv(long value) {
                long g = modulus(), x = 0, y = 1;
                for (long r = value; r != 0; ) {
                    long q = g / r;
                    g %= r;

                    long temp = g;
                    g = r;
                    r = temp;

                    x -= q * y;

                    temp = x;
                    x = y;
                    y = temp;
                }

                ASSERT(g == 1);
                ASSERT(y == modulus() || y == -modulus());

                return normalize(x);
            }

        }

        public static class Mod998 extends NumberTheory.Modulus<NumberTheory.Mod998> {
            public long modulus() {
                return 998_244_353L;
            }

        }

    }

    static class InputReader {
        public final BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.io.Closeable;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) throws Exception {
        Thread thread = new Thread(null, new TaskAdapter(), "", 1 << 27);
        thread.start();
        thread.join();
    }

    static class TaskAdapter implements Runnable {
        @Override
        public void run() {
            InputStream inputStream = System.in;
            OutputStream outputStream = System.out;
            FastInput in = new FastInput(inputStream);
            FastOutput out = new FastOutput(outputStream);
            EPlacingRooks solver = new EPlacingRooks();
            solver.solve(1, in, out);
            out.close();
        }
    }

    static class EPlacingRooks {
        public void solve(int testNumber, FastInput in, FastOutput out) {
            int n = in.readInt();
            int k = in.readInt();
            Modular mod = new Modular(998244353);
            int m = n - k;

            if (k == 0) {
                int ans = 1;
                for (int i = 1; i <= n; i++) {
                    ans = mod.mul(ans, i);
                }
                out.println(ans);
                return;
            }
            if (m <= 0 || m > n) {
                out.println(0);
                return;
            }

            PrimeCombination combination = new PrimeCombination(n, mod);
            Power power = new Power(mod);
            int ans = 0;
            for (int i = 0; i <= m; i++) {
                int local = combination.combination(m, i);
                if (i % 2 == 1) {
                    local = mod.valueOf(-local);
                }
                local = mod.mul(local, power.pow(m - i, n));
                ans = mod.plus(ans, local);
            }
            ans = mod.mul(ans, combination.combination(n, m));

            ans = mod.mul(ans, 2);
            out.println(ans);
        }

    }

    static interface IntCombination {
    }

    static class FastOutput implements AutoCloseable, Closeable, Appendable {
        private StringBuilder cache = new StringBuilder(10 << 20);
        private final Writer os;

        public FastOutput append(CharSequence csq) {
            cache.append(csq);
            return this;
        }

        public FastOutput append(CharSequence csq, int start, int end) {
            cache.append(csq, start, end);
            return this;
        }

        public FastOutput(Writer os) {
            this.os = os;
        }

        public FastOutput(OutputStream os) {
            this(new OutputStreamWriter(os));
        }

        public FastOutput append(char c) {
            cache.append(c);
            return this;
        }

        public FastOutput append(int c) {
            cache.append(c);
            return this;
        }

        public FastOutput println(int c) {
            return append(c).println();
        }

        public FastOutput println() {
            cache.append(System.lineSeparator());
            return this;
        }

        public FastOutput flush() {
            try {
                os.append(cache);
                os.flush();
                cache.setLength(0);
            } catch (IOException e) {
                throw new UncheckedIOException(e);
            }
            return this;
        }

        public void close() {
            flush();
            try {
                os.close();
            } catch (IOException e) {
                throw new UncheckedIOException(e);
            }
        }

        public String toString() {
            return cache.toString();
        }

    }

    static class InverseNumber {
        int[] inv;

        public InverseNumber(int[] inv, int limit, Modular modular) {
            this.inv = inv;
            inv[1] = 1;
            int p = modular.getMod();
            for (int i = 2; i <= limit; i++) {
                int k = p / i;
                int r = p % i;
                inv[i] = modular.mul(-k, inv[r]);
            }
        }

        public InverseNumber(int limit, Modular modular) {
            this(new int[limit + 1], limit, modular);
        }

    }

    static class FastInput {
        private final InputStream is;
        private byte[] buf = new byte[1 << 20];
        private int bufLen;
        private int bufOffset;
        private int next;

        public FastInput(InputStream is) {
            this.is = is;
        }

        private int read() {
            while (bufLen == bufOffset) {
                bufOffset = 0;
                try {
                    bufLen = is.read(buf);
                } catch (IOException e) {
                    bufLen = -1;
                }
                if (bufLen == -1) {
                    return -1;
                }
            }
            return buf[bufOffset++];
        }

        public void skipBlank() {
            while (next >= 0 && next <= 32) {
                next = read();
            }
        }

        public int readInt() {
            int sign = 1;

            skipBlank();
            if (next == '+' || next == '-') {
                sign = next == '+' ? 1 : -1;
                next = read();
            }

            int val = 0;
            if (sign == 1) {
                while (next >= '0' && next <= '9') {
                    val = val * 10 + next - '0';
                    next = read();
                }
            } else {
                while (next >= '0' && next <= '9') {
                    val = val * 10 - next + '0';
                    next = read();
                }
            }

            return val;
        }

    }

    static class PrimeCombination implements IntCombination {
        final Factorial factorial;
        final Modular modular;

        public PrimeCombination(Factorial factorial) {
            this.factorial = factorial;
            this.modular = factorial.getModular();
        }

        public PrimeCombination(int limit, Modular modular) {
            this(new Factorial(limit, modular));
        }

        public int combination(int m, int n) {
            if (n > m) {
                return 0;
            }
            return modular.mul(modular.mul(factorial.fact(m), factorial.invFact(n)), factorial.invFact(m - n));
        }

    }

    static class Modular {
        int m;

        public int getMod() {
            return m;
        }

        public Modular(int m) {
            this.m = m;
        }

        public Modular(long m) {
            this.m = (int) m;
            if (this.m != m) {
                throw new IllegalArgumentException();
            }
        }

        public Modular(double m) {
            this.m = (int) m;
            if (this.m != m) {
                throw new IllegalArgumentException();
            }
        }

        public int valueOf(int x) {
            x %= m;
            if (x < 0) {
                x += m;
            }
            return x;
        }

        public int valueOf(long x) {
            x %= m;
            if (x < 0) {
                x += m;
            }
            return (int) x;
        }

        public int mul(int x, int y) {
            return valueOf((long) x * y);
        }

        public int plus(int x, int y) {
            return valueOf(x + y);
        }

        public String toString() {
            return "mod " + m;
        }

    }

    static class Factorial {
        int[] fact;
        int[] inv;
        Modular modular;

        public Modular getModular() {
            return modular;
        }

        public Factorial(int[] fact, int[] inv, InverseNumber in, int limit, Modular modular) {
            this.modular = modular;
            this.fact = fact;
            this.inv = inv;
            fact[0] = inv[0] = 1;
            for (int i = 1; i <= limit; i++) {
                fact[i] = modular.mul(fact[i - 1], i);
                inv[i] = modular.mul(inv[i - 1], in.inv[i]);
            }
        }

        public Factorial(int limit, Modular modular) {
            this(new int[limit + 1], new int[limit + 1], new InverseNumber(limit, modular), limit, modular);
        }

        public int fact(int n) {
            return fact[n];
        }

        public int invFact(int n) {
            return inv[n];
        }

    }

    static class Power {
        final Modular modular;

        public Power(Modular modular) {
            this.modular = modular;
        }

        public int pow(int x, int n) {
            if (n == 0) {
                return modular.valueOf(1);
            }
            long r = pow(x, n >> 1);
            r = modular.valueOf(r * r);
            if ((n & 1) == 1) {
                r = modular.valueOf(r * x);
            }
            return (int) r;
        }

    }
}


/*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
If I'm the sun, you're the moon
Because when I go up, you go down
*******************************
I'm working for the day I will surpass you
https://www.a2oj.com/Ladder16.html
*/
import java.util.*;
import java.io.*;
import java.math.*;

   public class x1342E
   {
      static long MOD = 998244353L;
      public static void main(String omkar[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));
         StringTokenizer st = new StringTokenizer(infile.readLine());
         int N = Integer.parseInt(st.nextToken());
         long lmao = Long.parseLong(st.nextToken());
         if(lmao >= N)
            System.out.println(0);
         else
         {
            int K = (int)lmao;
            int C = N-K;
            fac = new long[200001];
            invfac = new long[200001];
            fac[0] = 1L;   invfac[0] = 1L;
            for(int i=1; i <= 200000; i++)
            {
               fac[i] = (fac[i-1]*i)%MOD;
               invfac[i] = power(fac[i], MOD-2, MOD);
            }
            long res = power(C, N, MOD);
            for(int e=1; e < C; e++)
            {
               long temp = power(C-e, N, MOD);
               temp = (temp*nCr(e, C))%MOD;
               if(e%2 == 1)
                  res = (res-temp+MOD)%MOD;
               else
                  res = (res+temp)%MOD;
            }
            res = (res*nCr(C, N))%MOD;
            if(K > 0)
               res = (2*res)%MOD;
            System.out.println(res);
         }
      }
      static long[] fac;
      static long[] invfac;
      public static long nCr(int a, int b)
      {
         long res = fac[b];
         res = (res*invfac[a])%MOD;
         return (res*invfac[b-a])%MOD;
      }
      public static long power(long x, long y, long p)
      {
          long res = 1L;
          x = x % p;
          while (y > 0)
          {
              if((y & 1)==1)
                  res = (res * x) % p;
              y = y >> 1;
              x = (x * x) % p;
          }
          return res;
      }
   }


import java.util.*;
import java.io.*;

public class E {
    public static long MOD = 998244353;
    public static long[] fact;
    public static long[] invfact;
    public static void main(String[] args) throws IOException{
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        StringTokenizer st = new StringTokenizer(f.readLine());
        fact = new long[200001];
        invfact = new long[200001];
        fact[0] = 1L;
        invfact[0] = 1L;
        for(int i = 1; i <= 200000; i++){
            fact[i] = (fact[i-1]*i);
            fact[i]%=MOD;
            invfact[i] = pow(fact[i], MOD-2, MOD)%MOD;
        }
        long n = Long.parseLong(st.nextToken());
        long k = Long.parseLong(st.nextToken());
        if(k > n){
            out.println(0);
            out.close();
            System.exit(0);
        }
        k = n-k;
        long ans = 0L;
        for(int i = 0; i <= k; i++){
            long curr = (ncr((int)k, i)*(pow(k-i, n, MOD)))%MOD;
            if(i % 2 == 0) ans+=curr;
            else ans-=curr;
            ans%=MOD;
            ans+=MOD;
            ans%=MOD;
        }
        ans*=(ncr((int)n, (int)k));
        ans%=MOD;
        if(n-k == 0) out.println(ans);
        else out.println((2*ans)%MOD);

        out.close();
    }
    public static long ncr(int n, int r){
        return (((fact[n]*invfact[r])%MOD)*invfact[n-r])%MOD;
    }

    public static long pow(long x, long y, long p){
        long res = 1L;

        while(y > 0){
            if(y % 2 != 0){
                res = (res*x)%p;
            }
            x = (x*x)%p;
            y/=2;
        }
        return res % p;

    }
}


import java.util.*;
public class PIEFLAVORED{
private static final long mod = 998244353;
   public static void main(String[] args)
   {
      Scanner ray = new Scanner(System.in);
      int n = ray.nextInt();
      long kk = ray.nextLong();
      if(kk >= n)
      {
         System.out.println("0");
      }
      else
      {
      int k = (int)(kk);
      int r = n - k;
      long[] rChoose = new long[r+1];
      rChoose[0] = (long)(1);
      long numChoose = 1;
      long denomChoose = 1;
      for(int i = 1; i <= r; i++)
      {
         numChoose = (numChoose*(r+1-i)) % mod;
         denomChoose = (denomChoose*i) % mod;
         rChoose[i] = (numChoose*power(denomChoose, mod-2)) % mod;
      }
      long ans = 0;
      long flipper = 1;
      for(int i = 0; i <= r; i++) //PIE
      {
         ans += power((long)(r-i), (long)(n))*flipper*rChoose[i];
         ans = ans % mod;
         flipper = -flipper;
      }
      ans = ans * choose((long)(n), (long)(k));
      ans = ans % mod;
      if(k > 0)
      {
         ans = ans*2;
      }
      ans = ans % mod;
      if(ans < 0)
      {
         ans += mod;
      }
      System.out.println(""+ans);
      }
   }
public static long choose(long n, long k)
    {
      long num = 1;
      long denom = 1;
      for(int i = (int)(n-k+1); i <= n; i++)
      {
         num = (num*i) % mod;
      }
      for(int i = 1; i <= k; i++)
      {
         denom = (denom*i) % mod;
      }
      denom = power(denom, mod-2) % mod;
      return (num*denom) % mod;
    }
public static long power(long x, long y)
{
    long res = 1;
    x = x % mod;
    while (y > 0)
    {

        if (y % 2 == 1)
        {    res = res*x;
            res = res % mod;}

        y = y>>1;
        x = x*x;
        x = x % mod;
    }
    return res;
}
}


 import java.io.*;
import java.util.*;

public class Kraskevich {
	FastScanner in;
	PrintWriter out;
	void solve() {
	int n = in.nextInt();
	char[] s = in.next().toCharArray();
	boolean ok = false;
	for(int step = 1; step <= n; step++){
	//int j = i;
	 //f = false;
	for(int start =0 ; start + 4 * step < n; start++){
	if (s[start] == '*' && s[start + step]=='*'
		 	&& s[start + 2 * step]=='*'&& s[start + 3 * step]=='*'&& s[start + 4* step]=='*')
	{
	  System.out.println("yes");
		out.close();
	}
	}
	}
 System.out.println("no");

	}

	void run() {
		try {
			in = new FastScanner(new File("B.in"));
			out = new PrintWriter(new File("B.out"));

			solve();

			out.close();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
	}

	void runIO() {

		in = new FastScanner(System.in);
		out = new PrintWriter(System.out);

		solve();

		out.close();
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

		public FastScanner(InputStream f) {
			br = new BufferedReader(new InputStreamReader(f));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				String s = null;
				try {
					s = br.readLine();
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (s == null)
					return null;
				st = new StringTokenizer(s);
			}
			return st.nextToken();
		}

		boolean hasMoreTokens() {
			while (st == null || !st.hasMoreTokens()) {
				String s = null;
				try {
					s = br.readLine();
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (s == null)
					return false;
				st = new StringTokenizer(s);
			}
			return true;
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}
	}

	public static void main(String[] args) {
		new Kraskevich().runIO();
	}
}


import java.io.*;
import java.util.*;

public class TaskA extends Thread {
    public TaskA(int what) {
        try {
            if (what == 0) {
                this.input = new BufferedReader(new InputStreamReader(System.in));
                this.output = new PrintWriter(System.out);
            } else {
                this.input = new BufferedReader(new FileReader(INPUT_FILE));
                this.output = new PrintWriter(OUTPUT_FILE);
            }
        } catch (Throwable e) {
            e.printStackTrace();
            System.exit(666);
        }
    }

    boolean check(int []x, int []y) {
        int square = (x[0] - x[2]) * (y[1] - y[2]) + (x[1] - x[2]) * (y[2] - y[0]);
        square *= square;
        if (square == 0) {
            return false;
        }
        //s = a * b / 2 => s ^ 2 = (ab) ^ 2 / 4
        int dist01 = (x[0] - x[1]) * (x[0] - x[1]) + (y[0] - y[1]) * (y[0] - y[1]),
                dist12 = (x[2] - x[1]) * (x[2] - x[1]) + (y[2] - y[1]) * (y[2] - y[1]),
                dist02 = (x[0] - x[2]) * (x[0] - x[2]) + (y[0] - y[2]) * (y[0] - y[2]);
        if (Math.min(Math.min(dist01, dist02), dist12) == 0) {
            return false;
        }
        if (dist01 * dist02 == square) {
            return true;
        }
        if (dist01 * dist12 == square) {
            return true;
        }
        if (dist02 * dist12 == square) {
            return true;
        }
        return false;
    }

    private void solve() throws Throwable {
        int []x = new int[3];
        int []y = new int[3];
        for (int i = 0; i < 3; ++i) {
            x[i] = nextInt();
            y[i] = nextInt();
        }
        int []dx = {-1, 0, 1, 0}, dy = {0, 1, 0, -1};
        if (check(x, y)) {
            output.println("RIGHT");
        } else {
            for (int i = 0; i < 3; ++i) {
                for (int j = 0; j < dx.length; ++j) {
                    x[i] += dx[j];
                    y[i] += dy[j];
                    if (check(x, y)) {
                        output.println("ALMOST");
                        return;
                    }
                    x[i] -= dx[j];
                    y[i] -= dy[j];
                }
            }
            output.println("NEITHER");
        }

    }

    public void run() {
        try {
            solve();
        } catch (Throwable e) {
            e.printStackTrace();
            System.exit(666);
        } finally {
            output.flush();
            output.close();
        }
    }

    public static void main(String... args) {
        new TaskA(0).start();
    }

    private String nextToken() throws IOException {
        while (tokens == null || !tokens.hasMoreTokens()) {
            tokens = new StringTokenizer(input.readLine());
        }
        return tokens.nextToken();
    }

    private int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    private double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    private long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    private String INPUT_FILE = null;
    private String OUTPUT_FILE = null;
    private BufferedReader input;
    private PrintWriter output;
    private StringTokenizer tokens = null;
}


import java.io.*;
import java.text.DecimalFormat;
import java.util.*;

public class Main {

    public static final DecimalFormat DF_3 = new DecimalFormat("0.000");
    private static final long MOD = 1000000007;

    static int[] readArray(int size, InputReader in, boolean subOne) {
        int[] a = new int[size];
        for (int i = 0; i < size; i++) {
            a[i] = in.nextInt() + (subOne ? -1 : 0);
        }
        return a;
    }

    static long[] readLongArray(int size, InputReader in) {
        long[] a = new long[size];
        for (int i = 0; i < size; i++) {
            a[i] = in.nextLong();
        }
        return a;
    }

    static void sortArray(int[] a) {
        Random random = new Random();

        for (int i = 0; i < a.length; i++) {
            int randomPos = random.nextInt(a.length);
            int t = a[i];
            a[i] = a[randomPos];
            a[randomPos] = t;
        }
        Arrays.sort(a);
    }

    private static long[] allInvs(int n, long mod) {
        long[] inv = new long[n + 1];
        inv[1] = 1;
        for (int i = 2; i <= n; ++i) {
            inv[i] = subMod(mod, (mod / i) * inv[(int) (mod % i)] % mod, mod);
        }
        return inv;

    }

    private static long subMod(long x, long y, long mod) {
        long res = x - y;
        if (res < 0) {
            return res + mod;
        }
        return res;
    }

    private static long fastPow(long x, long y, long mod) {
        if (x == 1) {
            return 1;
        }
        if (y == 0) {
            return 1;
        }
        long p = fastPow(x, y / 2, mod) % mod;
        p = p * p % mod;
        if (y % 2 == 1) {
            p = p * x % mod;
        }
        return p;
    }

    public static void main(String[] args) throws FileNotFoundException {
//        InputReader in = new InputReader(new FileInputStream("input.txt"));
//        PrintWriter out = new PrintWriter(new BufferedOutputStream(new FileOutputStream("milkvisits.out")));
//
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));

//        long start = System.currentTimeMillis();
        int n = in.nextInt();
        long mod = in.nextLong();
        long[] invs = allInvs(n + 3, mod);
        long[] facts = new long[n + 2];
        facts[0] = 1;
        long[] invFacts = new long[n + 2];
        invFacts[0] = 1;
        for (int i = 1; i < n + 2; i++) {
            facts[i] = (facts[i - 1] * i) % mod;
            invFacts[i] = (invFacts[i - 1] * invs[i]) % mod;
        }
        long[] pow2 = new long[n+3];
        pow2[0] = 1;
        for (int i = 1; i < n+3; i++) {
            pow2[i] = pow2[i-1] * 2 % mod;
        }

        long[][] dp = new long[n + 2][n + 2];
        for (int i = 2; i <= n + 1; i++) {
            dp[i][1] = invFacts[i - 1] * pow2[i - 2] % mod;
            for (int k = 2; k <= n; k++) {
                for (int j = i - 2; j >= 1; j--) {
                    dp[i][k] = (dp[i][k] + dp[j][k - 1] * pow2[ i - j - 2] % mod * invFacts[i - j - 1] % mod) % mod;
                }
            }
        }

        long ans = 0;
        for (int k = 1; k <= n; k++) {

            ans = (ans + dp[n + 1][k] * facts[n - k + 1] % mod) % mod;
        }
        out.println(ans);

        out.close();
    }

    private static void outputArray(List<Long> ans, PrintWriter out, boolean addOne) {
        StringBuilder str = new StringBuilder();
        for (int j = 0; j < ans.size(); j++) {
            long i = ans.get(j);
            long an = i + (addOne ? 1 : 0);
            str.append(an);
            if (j < ans.size() - 1) {
                str.append(' ');
            }
        }
        out.println(str);
//        out.flush();
    }

    private static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public String nextString() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public char nextChar() {
            return next().charAt(0);
        }

        public String nextWord() {
            return next();
        }

        private List<Integer>[] readTree(int n) {
            return readGraph(n, n - 1);
        }

        private List<Integer>[] readGraph(int n, int m) {
            List<Integer>[] result = new ArrayList[n];
            for (int i = 0; i < n; i++) {
                result[i] = new ArrayList<>();
            }
            for (int i = 0; i < m; i++) {
                int u = nextInt() - 1;
                int v = nextInt() - 1;
                result[u].add(v);
                result[v].add(u);
            }
            return result;
        }

    }
}


import java.util.*;
public class A
{
    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        int count=0,flag=0;
        if(n==m)
        System.out.println(0);
        else
        {
            while(m!=n)
            {
                if(m%(n*2)==0)
                {
                    count++;
                    n=n*2;
                }
                else if(m%(n*3)==0)
                {
                    count++;
                    n=n*3;
                }
                else
                {
                    flag=1;
                    break;
                }
            }
            if(flag==1)
            System.out.println(-1);
            else
            System.out.println(count);
        }
    }
}


import java.util.*;
import java.io.*;
import java.math.*;
import java.lang.*;

public class Main {
    private static FastReader sc = new FastReader(System.in);
    private static OutputWriter out = new OutputWriter(System.out);

    public static void main(String[] args) {
        int n = sc.nextInt();
        int k = sc.nextInt();
        int m = sc.nextInt();
        int a = sc.nextInt();

        int[] votes = new int[n];
        int[] lastTime = new int[n];
        Arrays.fill(lastTime, -1);
        Vote[] voteInfo = new Vote[n];

        int[] arr = new int[a];
        for (int i = 0; i < a; i++) {
            arr[i] = sc.nextInt() - 1;
            votes[arr[i]]++;
            lastTime[arr[i]] = i;
        }

        for (int i = 0; i < n; i++) {
            voteInfo[i] = new Vote(votes[i], lastTime[i], i);
        }
        Arrays.sort(voteInfo);

        int[] ans = new int[n];

        if (m == a) {
            for (int i = 0; i < n; i++) {
                if (i < k && voteInfo[i].votes > 0) ans[voteInfo[i].idx] = 1;
                else ans[voteInfo[i].idx] = 3;
            }

            for (int i : ans) System.out.print(i + " ");
            System.exit(0);
        }

        for (int i = 0; i < n; i++) {
            int curr = votes[i] + (m - a);
            int more = 0;
            for (int j = 0; j < n; j++) {
                if (j != i && votes[j] >= curr) more++;
            }
            if (more >= k || curr == 0) {
                ans[i] = 3;
                continue;
            }

            int minNeeded = 0;
            curr = votes[i];
            HashSet<Integer> need = new HashSet<>();
            boolean bool = false;

            for (int j = 0; j <= Math.min(n - 1, k); j++) {
                if (voteInfo[j].idx == i) {
                    bool = true;
                    continue;
                }
                if (!bool && j == k) break;
                if (voteInfo[j].votes == curr && (voteInfo[j].lastTime > lastTime[i] || voteInfo[j].votes == 0)) {
                    minNeeded++;
                } else if (voteInfo[j].votes < curr) {
                    minNeeded += (curr - voteInfo[j].votes + 1);
                }
                need.add(j);
            }

            if (votes[i] > 0 && (minNeeded > m - a || need.size() < k)) {
                ans[i] = 1;
            } else {
                ans[i] = 2;
            }
        }

        for (int i : ans) out.print(i + " ");
        out.close();
    }
}

class Vote implements Comparable<Vote> {
    int votes, lastTime, idx;

    public Vote(int a, int b, int c) {
        votes = a;
        lastTime = b;
        idx = c;
    }

    public int compareTo(Vote that) {
        if (this.votes > that.votes) return -1;
        if (this.votes < that.votes) return +1;
        if (this.lastTime > that.lastTime) return +1;
        return -1;
    }
}

class FastReader {
    private boolean finished = false;

    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private SpaceCharFilter filter;

    public FastReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (numChars == -1) {
            throw new InputMismatchException();
        }
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0) {
                return -1;
            }
        }

        return buf[curChar++];
    }

    public int peek() {
        if (numChars == -1) {
            return -1;
        }
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                return -1;
            }
            if (numChars <= 0) {
                return -1;
            }
        }
        return buf[curChar];
    }

    public int nextInt() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c == ',') {
                c = read();
            }
            if (c < '0' || c > '9') {
                throw new InputMismatchException();
            }
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public long nextLong() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9') {
                throw new InputMismatchException();
            }
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public String nextString() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }

    public boolean isSpaceChar(int c) {
        if (filter != null) {
            return filter.isSpaceChar(c);
        }
        return isWhitespace(c);
    }

    public static boolean isWhitespace(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    private String readLine0() {
        StringBuilder buf = new StringBuilder();
        int c = read();
        while (c != '\n' && c != -1) {
            if (c != '\r') {
                buf.appendCodePoint(c);
            }
            c = read();
        }
        return buf.toString();
    }

    public String nextLine() {
        String s = readLine0();
        while (s.trim().length() == 0)
            s = readLine0();
        return s;
    }

    public String nextLine(boolean ignoreEmptyLines) {
        if (ignoreEmptyLines) {
            return nextLine();
        } else {
            return readLine0();
        }
    }

    public BigInteger nextBigInteger() {
        try {
            return new BigInteger(nextString());
        } catch (NumberFormatException e) {
            throw new InputMismatchException();
        }
    }

    public char nextCharacter() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        return (char) c;
    }

    public double nextDouble() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        double res = 0;
        while (!isSpaceChar(c) && c != '.') {
            if (c == 'e' || c == 'E') {
                return res * Math.pow(10, nextInt());
            }
            if (c < '0' || c > '9') {
                throw new InputMismatchException();
            }
            res *= 10;
            res += c - '0';
            c = read();
        }
        if (c == '.') {
            c = read();
            double m = 1;
            while (!isSpaceChar(c)) {
                if (c == 'e' || c == 'E') {
                    return res * Math.pow(10, nextInt());
                }
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                m /= 10;
                res += (c - '0') * m;
                c = read();
            }
        }
        return res * sgn;
    }

    public boolean isExhausted() {
        int value;
        while (isSpaceChar(value = peek()) && value != -1)
            read();
        return value == -1;
    }

    public String next() {
        return nextString();
    }

    public SpaceCharFilter getFilter() {
        return filter;
    }

    public void setFilter(SpaceCharFilter filter) {
        this.filter = filter;
    }

    public interface SpaceCharFilter {
        public boolean isSpaceChar(int ch);
    }
}

class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }

    public void print(Object... objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0)
                writer.print(' ');
            writer.print(objects[i]);
        }
    }

    public void printLine(Object... objects) {
        print(objects);
        writer.println();
    }

    public void close() {
        writer.close();
    }

    public void flush() {
        writer.flush();
    }

}


import java.io.*;    //PrintWriter
import java.math.*;  //BigInteger, BigDecimal
import java.util.*;  //StringTokenizer, ArrayList

public class R285_Div2_A
{
	FastReader in;
	PrintWriter out;

	public static void main(String[] args)  {
		new R285_Div2_A().run();
	}

	void run()
	{
		in = new FastReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	void solve()
	{
		int a = in.nextInt();
		int b = in.nextInt();
		int c = in.nextInt();
		int d = in.nextInt();

		int m = score(a,c);
		int v = score(b,d);

		if (m > v)
			out.println("Misha");
		else if (m < v)
			out.println ("Vasya");
		else
			out.println("Tie");
	}

	int score(int p, int t)
	{
		return Math.max(3*p/10,  p - p/250*t);
	}

	//-----------------------------------------------------
	void runWithFiles() {
		in = new FastReader(new File("input.txt"));
		try {
			out = new PrintWriter(new File("output.txt"));
		}
		catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		solve();
		out.close();
	}

	class FastReader
	{
	    BufferedReader br;
	    StringTokenizer tokenizer;

	    public FastReader(InputStream stream)
	    {
	        br = new BufferedReader(new InputStreamReader(stream));
	        tokenizer = null;
	    }
		public FastReader(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
				tokenizer = null;
			}
			catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

	    private String next() {
	        while (tokenizer == null || !tokenizer.hasMoreTokens())
	            try {
	            	tokenizer = new StringTokenizer(br.readLine());
	            }
	            catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        return tokenizer.nextToken();
	    }
		public String nextLine() {
			try	{
				return br.readLine();
			}
			catch(Exception e) {
				throw(new RuntimeException());
			}
		}

	    int nextInt() {
	        return Integer.parseInt(next());
	    }
	    long nextLong() {
	        return Long.parseLong(next());
	    }
	    double nextDouble() {
	        return Double.parseDouble(next());
	    }
	    BigInteger nextBigInteger() {
	        return new BigInteger(next());
	    }
	    BigDecimal nextBigDecimal() {
	        return new BigDecimal(next());
	    }
	}
}


import java.util.*;
import java.lang.*;
import java.io.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
	    Scanner sc=new Scanner(System.in);

// int t=sc.nextInt();
// while(t-->0)
// {
    int n=sc.nextInt();
   System.out.println(pow(1378,n));

// }
}
public static int pow(int a,int n)
{int res=1;
  while(n>0)
  {
    if(n%2==1)
    {
        res=(res*a)%10;
        n--;
    }
    else
    {
        a=(a*a)%10;
        n=n/2;
    }
  }
    return res;
}
}


import java.io.IOException;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author bkand1908
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        long l = in.readInt();
        long r = in.readInt();
        long base = 1;
        while (base <= r) base *= 10;
        long m = base >> 1;
        if (m > r) m = r;
        if (m < l) m = l;
        out.println(m * reflection(m));
    }

    private long reflection(long a) {
        StringBuilder s = new StringBuilder();
        while (a > 0) {
            s.insert(0, String.valueOf(9 - a % 10));
            a /= 10;
        }
        return Long.parseLong(s.toString());
    }
}

class InputReader {

        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
                this.stream = stream;
        }

        public int read() {
                if (numChars == -1)
                        throw new InputMismatchException();
                if (curChar >= numChars) {
                        curChar = 0;
                        try {
                                numChars = stream.read(buf);
                        } catch (IOException e) {
                                throw new InputMismatchException();
                        }
                        if (numChars <= 0)
                                return -1;
                }
                return buf[curChar++];
        }

        public int readInt() {
                int c = read();
                while (isSpaceChar(c))
                        c = read();
                int sgn = 1;
                if (c == '-') {
                        sgn = -1;
                        c = read();
                }
                int res = 0;
                do {
                        if (c < '0' || c > '9')
                                throw new InputMismatchException();
                        res *= 10;
                        res += c - '0';
                        c = read();
                } while (!isSpaceChar(c));
                return res * sgn;
        }

        private boolean isSpaceChar(int c) {
                return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        }


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import java.util.* ;
import java.io.* ;
import java.math.* ;
/************************
 *                      *
 *    Lord Klotski      *
 *                      *
 ***********************/
public class CodeForces_2011_Jan13_A
{
    public static void main(String[] args)
    {
        Scanner input = new Scanner(System.in) ;
        //int K = input.nextInt()  ;
        /*for (int K = 1 ; K <= 50 ; K ++)
        {
            boolean[] a = new boolean[K] ;
            int place = 0 ;
            for (int i = 1 ; i < 100000 ; i ++)
            {
                place += (i-1) ; place %= K ; a[place] = true ;
            }
            boolean fail = false ;
            for (int i = 0 ; i < K ; i ++) if (a[i] == false) fail = true ;
            System.out.println(K + " " + (fail ? "NO" : "YES"));
        }*/

        int K = input.nextInt() ;
        boolean[] twoPow = new boolean[1001] ; twoPow[0] = true ; int x = 1 ;
        while( x <= 1000)
        {
            twoPow[x] = true ; x *= 2 ;
        }
        System.out.println(twoPow[K] ? "YES" : "NO");

    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
/**
 *
10%1=1
10%11 = 10

21%8 = 5
21%16 = 5

21%8 = 5
21%16 = 5

21%6 = 3
21%9 = 3
21%18 = 3

24 3
24%21 = 3
24%7 = 3

33 1

43 i*i = i->6

43%2 = 1
43%3 = 1
43%6 = 1
43%7 = 1
43%12 = 1
43%21 = 1
43%4

**/

public class B_Div2_282 {
    public static void main(String[]arg) throws IOException
    {
       BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
       StringTokenizer st = new StringTokenizer(in.readLine());

       long a = Long.parseLong(st.nextToken());
       long b = Long.parseLong(st.nextToken());
       if(a == b)
           System.out.println("infinity");
       else if(b > a)
       {
           System.out.println(0);
       }
       else
       {
           long rest = a - b;
           int ans = 0;
           for(long i = 1; i*i <= rest; i++)
           {
               if(rest%i == 0)
               {
                   if(a%i == b)
                       ans++;
                   /*
                   Para no agregar dos veces debido a que (rest/i) = i
                   por eso i != a/i
                   */

                   if(a%(rest/i) == b && i != a/i)
                       ans++;
               }
           }
           System.out.println(ans);
       }
    }
}


import java.io.*;
import java.util.*;

public class EMain {
    String noResultMessage = "NoResult";
    Parser in = new Parser();
    PrintWriter out;

    long n = in.nextLong();
    int k = in.nextInteger();

    Matrix[] upRow(Matrix[] row){
        Matrix[] suffix = new Matrix[k];
        suffix[0] = Matrix.oneMatrix(k+1);
        for(int i = 1; i < k; ++i){
            suffix[i] = Matrix.mul(suffix[i-1], row[i-1]);
        }
        Matrix[] prefix = new Matrix[k];
        prefix[k-1] = row[k-1];
        for(int i = k-2; i>=0; --i){
            prefix[i] = Matrix.mul(row[i], prefix[i+1]);
        }
        Matrix[] result = new Matrix[k];
        for(int i = 0; i < k; ++i){
            result[i] = Matrix.mul(prefix[i], suffix[i]);
        }
        return result;
    }

    public void solve() {

        Matrix[][] matrixes = new Matrix[100][k];

        for(int i = 0; i < k; ++i){
            Matrix m = Matrix.oneMatrix(k + 1);
            matrixes[0][i] = m;
            for(int j = 0; j <= k; ++j){
                m.set(j, i, 1);
            }
        }
        int[] digits = new int[100];
        int index = 0;
        long limit = n;
        digits[index++] = (int) (limit % k);
        for(int row = 1; row < 100; ++row){
            limit /= k;
            if(limit == 0)break;
            digits[index++] = (int) (limit % k);
            matrixes[row] = upRow(matrixes[row-1]);
        }

        Matrix result = Matrix.oneMatrix(k+1);
        int pos = 0;
        while(index-- > 0){
            while(digits[index]-- > 0){
                result = Matrix.mul(result, matrixes[index][pos++]);
                pos %= k;
            }
        }
        Vector vec = new Vector(k+1);
        vec.set(k, 1);
        out.println(Vector.mul(vec, result).sum());

    }

    static int MOD = (int) (1e9+7);

    static public class Matrix {
        int[][] data;

        public Matrix(int size) {
            this.data = new int[size][size];
        }

        Matrix(Matrix other) {
            int size = other.data.length;
            this.data = new int[size][];
            for(int i = 0; i < size; ++i){
                this.data[i] = Arrays.copyOf(other.data[i], size);
            }
        }
        public void set(int row, int column, int value){
            data[row][column] = value;
        }

        public static Matrix oneMatrix(int size){
            Matrix result = new Matrix(size);
            for(int i = 0; i < size; ++i){
                result.data[i][i] = 1;
            }
            return result;
        }

        public static Matrix mul(Matrix left, Matrix right){
            int size = left.data.length;
            assert size == right.data.length;
            Matrix result = new Matrix(size);
            for(int i = 0; i < size; ++i){
                for(int j = 0; j < size; ++j){
                    int val = 0;
                    for(int k = 0; k < size; ++k){
                        val += 1l * left.data[i][k] * right.data[k][j] % MOD;
                        val %= MOD;
                        val += MOD;
                        val %= MOD;
                    }
                    result.data[i][j] = val;
                }
            }
            return result;
        }

        static Matrix degree(Matrix matrix, long degree){
            Matrix result = Matrix.oneMatrix(matrix.data.length);
            while(degree > 0){
                if((degree & 1) == 1){
                    result = Matrix.mul(result, matrix);
                }
                result = Matrix.mul(result, result);
                degree >>= 1;
            }
            return result;
        }
    }

    static public class Vector{
        int[] data;

        public Vector(int size) {
            this.data = new int[size];
        }

        Vector(Vector other) {
            this.data = Arrays.copyOf(other.data, other.data.length);
        }

        public void set(int pos, int val){
            data[pos] = val;
        }

        int get(int pos){
            return data[pos];
        }

        public int sum(){
            long sum = 0;
            for(int i : data){
                sum += i;
            }
            sum %= MOD;
            sum += MOD;
            sum %= MOD;
            return (int) sum;
        }

        public static Vector mul(Vector vec, Matrix matrix){
            int size = vec.data.length;
            assert size == matrix.data.length;
            Vector result = new Vector(size);
            for(int i = 0; i < size; ++i){
                int val = 0;
                for(int j = 0; j < size; ++j){
                    val += 1l * vec.data[j] * matrix.data[j][i] % MOD;
                    val += MOD;
                    val %= MOD;
                }
                result.data[i] = val;
            }
            return result;
        }
    }

    static public class Parser{
        Scanner scanner;

        public Parser() {
            scanner = new Scanner(System.in).useLocale(Locale.ENGLISH);
        }

        public Parser(String str) {
            scanner = new Scanner(str).useLocale(Locale.ENGLISH);
        }

        long nextLong(){
            return scanner.nextLong();
        }

        int nextInteger(){
            return scanner.nextInt();
        }

        double nextDouble(){
            return scanner.nextDouble();
        }

        String nextLine(){
            return scanner.nextLine();
        }

        String next(){
            return scanner.next();
        }

        int[] nextIntegers(int count){
            int[] result = new int[count];
            for(int i = 0; i < count; ++i){
                result[i] = nextInteger();
            }
            return result;
        }

        long[] nextLongs(int count){
            long[] result = new long[count];
            for(int i = 0; i < count; ++i){
                result[i] = nextLong();
            }
            return result;
        }

        int[][] nextIntegers(int fields, int count){
            int[][] result = new int[fields][count];
            for(int c = 0; c < count; ++c){
                for(int i = 0; i < fields; ++i){
                    result[i][c] = nextInteger();
                }
            }
            return result;
        }
    }

    void noResult(){
        throw new NoResultException();
    }

    void noResult(String str){
        throw new NoResultException(str);
    }

    void run(){
        try{
            ByteArrayOutputStream outStream = new ByteArrayOutputStream();
            out = new PrintWriter(outStream);
            solve();
            out.close();
            System.out.print(outStream.toString());
        } catch (NoResultException exc){
            System.out.print(null == exc.response ? noResultMessage : exc.response);
        }
    }

    public static void main(String[] args) {
        new EMain().run();
    }

    public static class NoResultException extends RuntimeException{
        private String response;

        public NoResultException(String response) {
            this.response = response;
        }

        public NoResultException() {
        }
    }
}


// practice with kaiboy
import java.io.*;
import java.util.*;

public class CF42B extends PrintWriter {
	CF42B() { super(System.out, true); }
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		CF42B o = new CF42B(); o.main(); o.flush();
	}

	boolean rcheck(int ir, int jr, int ik, int jk, int i, int j) {
		if (ir == i && jr == j)
			return false;
		if (ir == i)
			return ik != i || jk < Math.min(jr, j) || jk > Math.max(jr, j);
		if (jr == j)
			return jk != j || ik < Math.min(ir, i) || ik > Math.max(ir, i);
		return false;
	}
	boolean kcheck(int ik, int jk, int i, int j) {
		return Math.max(Math.abs(ik - i), Math.abs(jk - j)) == 1;
	}
	void main() {
		String r1 = sc.next();
		String r2 = sc.next();
		String k1 = sc.next();
		String k2 = sc.next();
		int ir1 = r1.charAt(0) - 'a';
		int jr1 = r1.charAt(1) - '1';
		int ir2 = r2.charAt(0) - 'a';
		int jr2 = r2.charAt(1) - '1';
		int ik1 = k1.charAt(0) - 'a';
		int jk1 = k1.charAt(1) - '1';
		int ik2 = k2.charAt(0) - 'a';
		int jk2 = k2.charAt(1) - '1';
		for (int di = -1; di <= 1; di++)
			for (int dj = -1; dj <= 1; dj++) {
				int i = ik2 + di;
				int j = jk2 + dj;
				if (i >= 0 && i < 8 && j >= 0 && j < 8) {
					if (kcheck(ik1, jk1, i, j))
						continue;
					if (rcheck(ir1, jr1, ik1, jk1, i, j))
						continue;
					if (rcheck(ir2, jr2, ik1, jk1, i, j))
						continue;
					println("OTHER");
					return;
				}
			}
		println("CHECKMATE");
	}
}


import java.util.Scanner;
public class Problem811 {
	public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);
		int vladik = scanner.nextInt();
		int vlera = scanner.nextInt();
		int minues = 1;
		boolean boo = true;
		//System.out.println("Vladik:"+vladik+" Valera:"+vlera);
		while (vladik-minues>0 && vlera-minues>0){

			if(boo){

				vladik=vladik-minues;
				//System.out.println("Vladik: "+vladik);
				minues=minues+1;
				boo=false;
			}else{

				vlera=vlera-minues;
				//System.out.println("Valera: "+vlera);
				minues=minues+1;
				boo=true;
			}
		}
		//System.out.println("vladik: "+vladik+ " valera: "+ vlera + " minues: "+minues + " boo: "+ boo);
		if((vladik-minues<=0 && vlera-minues<=0 && !boo) ){
			System.out.println("Vladik");
		}
		else if((vladik-minues<=0 && vlera-minues<=0 && boo)){
			System.out.println("Valera");
		}else if(vladik-minues<=0){
			System.out.println("Vladik");
		}else if(vlera-minues<=0){
			System.out.println("Valera");
		}

	}
}


import java.util.Scanner;

public class Fobonacci {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] c = sc.nextLine().toCharArray();
		int[] a = new int[c.length];
		for(int i=0;i<c.length;i++) {
			a[i] = c[i] - 'A';
		}
		//System.out.println(Arrays.toString(a));
		boolean isNo = false;
		for(int i=2;i<a.length;i++) {

			if(a[i] != (a[i-1] + a[i-2])%26) {
				System.out.println("NO");
				isNo = true;
				break;
			}

		}
		if(!isNo) {
			System.out.println("YES");
		}

		sc.close();
	}
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Sanket Makani
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ProblemA1DeathStarsEasy solver = new ProblemA1DeathStarsEasy();
        solver.solve(1, in, out);
        out.close();
    }

    static class ProblemA1DeathStarsEasy {
        public void solve(int testNumber, InputReader sc, PrintWriter w) {
            int n = sc.nextInt();

            char map1[][] = new char[n][n];
            char map2[][] = new char[n][n];

            for (int i = 0; i < n; i++)
                map1[i] = sc.next().toCharArray();
            for (int i = 0; i < n; i++)
                map2[i] = sc.next().toCharArray();
            int flag = 0;

            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    if (map1[i][j] != map2[i][j])
                        flag++;
                }
            }

            if (flag == 0) {
                w.println("Yes");
                return;
            }

            flag = 0;

            //90 degree
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    if (map1[i][j] != map2[j][n - i - 1])
                        flag++;
                }
            }

            if (flag == 0) {
                w.println("Yes");
                return;
            }

            flag = 0;

            //180 degree
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    if (map1[i][j] != map2[n - i - 1][n - j - 1])
                        flag++;
                }
            }

            if (flag == 0) {
                w.println("Yes");
                return;
            }

            flag = 0;

            //270 degree
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    if (map1[i][j] != map2[n - j - 1][i])
                        flag++;
                }
            }

            if (flag == 0) {
                w.println("Yes");
                return;
            }

            flag = 0;

            flipVertically(map2);

            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    if (map1[i][j] != map2[i][j])
                        flag++;
                }
            }

            if (flag == 0) {
                w.println("Yes");
                return;
            }

            flag = 0;

            //90 degree
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    if (map1[i][j] != map2[j][n - i - 1])
                        flag++;
                }
            }

            if (flag == 0) {
                w.println("Yes");
                return;
            }

            flag = 0;

            //180 degree
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    if (map1[i][j] != map2[n - i - 1][n - j - 1])
                        flag++;
                }
            }

            if (flag == 0) {
                w.println("Yes");
                return;
            }

            flag = 0;

            //270 degree
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    if (map1[i][j] != map2[n - j - 1][i])
                        flag++;
                }
            }

            if (flag == 0) {
                w.println("Yes");
                return;
            }

            flag = 0;

            flipVertically(map2);

            flipHorizontally(map2);

            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    if (map1[i][j] != map2[i][j])
                        flag++;
                }
            }

            if (flag == 0) {
                w.println("Yes");
                return;
            }

            flag = 0;

            //90 degree
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    if (map1[i][j] != map2[j][n - i - 1])
                        flag++;
                }
            }

            if (flag == 0) {
                w.println("Yes");
                return;
            }

            flag = 0;

            //180 degree
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    if (map1[i][j] != map2[n - i - 1][n - j - 1])
                        flag++;
                }
            }

            if (flag == 0) {
                w.println("Yes");
                return;
            }

            flag = 0;

            //270 degree
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    if (map1[i][j] != map2[n - j - 1][i])
                        flag++;
                }
            }

            if (flag == 0) {
                w.println("Yes");
                return;
            }

            w.println("No");
        }

        private void flipHorizontally(char[][] map2) {
            int n = map2.length;
            char copy[][] = new char[n][n];
            for (int i = 0; i < n; i++)
                for (int j = 0; j < n; j++)
                    copy[i][j] = map2[i][j];

            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    map2[i][j] = copy[i][n - j - 1];
                }
            }
        }

        private void flipVertically(char[][] map2) {
            int n = map2.length;
            char copy[][] = new char[n][n];
            for (int i = 0; i < n; i++)
                for (int j = 0; j < n; j++)
                    copy[i][j] = map2[i][j];

            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    map2[i][j] = copy[n - i - 1][j];
                }
            }
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return readString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}


import java.util.Scanner;

public class Two {
	static Scanner in = new Scanner(System.in);
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		int a,b,a1,b1,a2,b2;
		boolean flag=false;
		a=in.nextInt();
		b=in.nextInt();
		a1=in.nextInt();
		b1=in.nextInt();
		a2=in.nextInt();
		b2=in.nextInt();

		while(true){
		if((a>=Math.max(a1,a2))&& b>=Math.max(b1, b2)){
			if(a>=a1+a2)
				flag=true;
			else if(b>=b1+b2)
				flag=true;
		}
		if(flag==true)
			break;

		if((a>=Math.max(a1,b2))&& b>=Math.max(b1, a2)){
			if(a>=a1+b2)
				flag=true;
			else if(b>=b1+a2)
				flag=true;
		}
		if(flag==true)
			break;

		if((a>=Math.max(a2,b1))&& b>=Math.max(a1, b2)){
			if(a>=a2+b1)
				flag=true;
			else if(b>=a1+b2)
				flag=true;
		}
		if(flag==true)
			break;

		if((a>=Math.max(b2,b1))&& b>=Math.max(a2, a1)){
			if(a>=b2+b1)
				flag=true;
			else if(b>=a2+a1)
				flag=true;
		}

		break;
		}
		if(flag==true)
		System.out.println("YES");
		else
			System.out.println("NO");
		}
	}


// 作者：杨成瑞先生
import java.io.*;
import java.util.*;

public class curriculum {

	static class FastScanner {

        static final int DEFAULT_BUFF = 1024, EOF = -1, INT_MIN = 48, INT_MAX = 57;
        static final byte NEG = 45;
        static final int[] ints = new int[58];

        static {
            int value = 0;
            for (int i = 48; i < 58; i++) {
                ints[i] = value++;
            }
        }

        InputStream stream;

        byte[] buff;
        int buffPtr;

        public FastScanner(InputStream stream) {
            this.stream = stream;
            this.buff = new byte[DEFAULT_BUFF];
            this.buffPtr = -1;
        }

        public int nextInt() throws IOException {
            int val = 0;
            int sign = readNonDigits();
            while (isDigit(buff[buffPtr]) && buff[buffPtr] != EOF) {
                val = (val << 3) + (val << 1) + ints[buff[buffPtr]];
                buffPtr++;
                if (buffPtr == buff.length) {
                    updateBuff();
                }
            }
            return val*sign;
        }

        private int readNonDigits() throws IOException {
            if (buffPtr == -1 || buffPtr == buff.length) {
                updateBuff();
            }
            if (buff[buffPtr] == EOF) {
                throw new IOException("End of stream reached");
            }
            int signByte = -1;
            while (!isDigit(buff[buffPtr])) {
                signByte = buff[buffPtr];
                buffPtr++;
                if (buffPtr >= buff.length) {
                    updateBuff();
                }
                if (buff[buffPtr] == EOF) {
                    throw new IOException("End of stream reached");
                }
            }
            if(signByte == NEG) return -1;
            return 1;
        }

        public void close() throws IOException {
            stream.close();
        }

        private boolean isDigit(int b) {
            return b >= INT_MIN && b <= INT_MAX;
        }

        private void updateBuff() throws IOException {
            buffPtr = 0;
            stream.read(buff);
        }
    }

	public static void main(String[] args) throws IOException {
		FastScanner sc = new FastScanner(System.in);
        int n = sc.nextInt();
        int[] games = new int[n];
        for(int i=0;i<n;i++) {
            games[i] = sc.nextInt();
        }
        int max = 0;
        for(int i=0;i<=n;i++) {
            int current = 0;
            for(int j=0;j<i;j++) {
                if(games[j] == 0) {
                    current++;
                }
            }
            for(int k=i;k<n;k++) {
                if(games[k] == 1) {
                    current++;
                }
            }
            max = Math.max(max, current);
        }
        System.out.println(max);
	}

}

// 6
// 0 1 0 0 1 0