#![allow(unused_imports)]
#![cfg_attr(feature = "cargo-clippy", allow(redundant_field_names))]

use std::cell::{Cell, RefCell};
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::io::{self, BufWriter, Read, Write};
use std::ops::{
    Add, AddAssign, BitAnd, BitAndAssign, BitOr, BitOrAssign, BitXor, BitXorAssign, Div, DivAssign,
    Mul, MulAssign, Neg, Not, Rem, RemAssign, Sub, SubAssign,
};
use std::str::{self, FromStr};
use std::{char, cmp, f32, f64, fmt, i16, i32, i64, i8, thread, u16, u32, u64, u8};

fn main() {
    scan_all(io::stdin(), 1024);
    let (a, b) = (r::<u32>(), r::<u32>());
    println!("{}", (a - 1) * (b - 1));
}

thread_local! {
    static SCANNED: RefCell<Scanned> = RefCell::default();
}

fn scan_all<R: Read>(mut input: R, estimated: usize) {
    let mut buf = Vec::with_capacity(estimated);
    let _ = io::copy(&mut input, &mut buf).unwrap();
    if buf.last() != Some(&b'\n') {
        buf.push(b'\n');
    }
    SCANNED.with(|scanned| scanned.borrow_mut().buf = buf);
}

fn r<T: FromStr>() -> T
where
    T::Err: fmt::Debug,
{
    SCANNED.with(|scanned| scanned.borrow_mut().next())
}

#[allow(dead_code)]
fn rv<T: FromStr>(n: usize) -> Vec<T>
where
    T::Err: fmt::Debug,
{
    SCANNED.with(|scanned| {
        let mut scanned = scanned.borrow_mut();
        (0..n).map(|_| scanned.next()).collect()
    })
}

#[allow(dead_code)]
fn rp<T1: FromStr, T2: FromStr>(n: usize) -> Vec<(T1, T2)>
where
    T1::Err: fmt::Debug,
    T2::Err: fmt::Debug,
{
    SCANNED.with(|scanned| {
        let mut scanned = scanned.borrow_mut();
        (0..n).map(|_| (scanned.next(), scanned.next())).collect()
    })
}

#[allow(dead_code)]
fn rt<T1: FromStr, T2: FromStr, T3: FromStr>(n: usize) -> Vec<(T1, T2, T3)>
where
    T1::Err: fmt::Debug,
    T2::Err: fmt::Debug,
    T3::Err: fmt::Debug,
{
    SCANNED.with(|scanned| {
        let mut scanned = scanned.borrow_mut();
        (0..n)
            .map(|_| (scanned.next(), scanned.next(), scanned.next()))
            .collect()
    })
}

#[allow(dead_code)]
fn rq<T1: FromStr, T2: FromStr, T3: FromStr, T4: FromStr>(n: usize) -> Vec<(T1, T2, T3, T4)>
where
    T1::Err: fmt::Debug,
    T2::Err: fmt::Debug,
    T3::Err: fmt::Debug,
    T4::Err: fmt::Debug,
{
    SCANNED.with(|scanned| {
        let mut scanned = scanned.borrow_mut();
        (0..n)
            .map(|_| {
                (
                    scanned.next(),
                    scanned.next(),
                    scanned.next(),
                    scanned.next(),
                )
            }).collect()
    })
}

#[allow(dead_code)]
fn rm<T: FromStr>(m: usize, n: usize) -> Vec<Vec<T>>
where
    T::Err: fmt::Debug,
{
    SCANNED.with(|scanned| {
        let mut scanned = scanned.borrow_mut();
        (0..m)
            .map(|_| (0..n).map(|_| scanned.next()).collect())
            .collect()
    })
}

#[allow(dead_code)]
fn r_char_mat<T, F: FnMut(u8) -> T>(h: usize, mut f: F) -> Vec<Vec<T>> {
    SCANNED.with(|scanned| {
        let mut scanned = scanned.borrow_mut();
        (0..h)
            .map(|_| {
                let l = scanned.next::<String>();
                l.as_bytes().iter().cloned().map(&mut f).collect()
            }).collect()
    })
}

#[derive(Default)]
struct Scanned {
    buf: Vec<u8>,
    pos: usize,
}

impl Scanned {
    #[inline]
    fn next<T: FromStr>(&mut self) -> T
    where
        T::Err: fmt::Debug,
    {
        let mut start = None;
        loop {
            match (self.buf[self.pos], start.is_some()) {
                (b' ', true) | (b'\n', true) => break,
                (_, true) | (b' ', false) | (b'\n', false) => self.pos += 1,
                (_, false) => start = Some(self.pos),
            }
        }
        let target = &self.buf[start.unwrap()..self.pos];
        unsafe { str::from_utf8_unchecked(target) }.parse().unwrap()
    }
}


Measured memory_bytes: 4352