Problem:
﻿Score: 100 points

Problem Statement

There is a farm whose length and width are A yard and B yard, respectively. A farmer, John, made a vertical road and a horizontal road inside the farm from one border to another, as shown below: (The gray part represents the roads.)

What is the area of this yard excluding the roads? Find it.

Note

It can be proved that the positions of the roads do not affect the area.

Constraints

A is an integer between 2 and 100 (inclusive).

B is an integer between 2 and 100 (inclusive).

Input

Input is given from Standard Input in the following format:

A B

Output

Print the area of this yard excluding the roads (in square yards).

Sample Input 1

2 2

Sample Output 1

1

In this case, the area is 1 square yard.

Sample Input 2

5 7

Sample Output 2

24

In this case, the area is 24 square yards.

Solution in C# (Mono 4.6.2.0) (judge verdict: Runtime Error)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using static System.Console;
using static PB10004.Algorithm.Util;

namespace PB10004.Algorithm
{
    class Template
    {
        static void Main(string[] args)
        {
            new D().Solve();
        }
    }
    class A
    {
        public void Solve()
        {
            var array = ReadIntArray();
            WriteLine((array[0] - 1) * (array[1] - 1));
        }
    }
    class B
    {
        public void Solve()
        {
            var N = ReadLong();
            if (N < 105)
            {
                WriteLine(0);
            }
            else if (N < 135)
            {
                WriteLine(1);
            }
            else if (N < 165)
            {
                WriteLine(2);
            }
            else if (N < 189)
            {
                WriteLine(3);
            }
            else if (N < 195)
            {
                WriteLine(4);
            }
            else
            {
                WriteLine(5);
            }
        }
    }
    class C
    {
        public void Solve()
        {
            var line = ReadLine();
            var K = ulong.Parse(ReadLine());
            int i = 0;
            while (line[i] == '1')
            {
                i++;
                if ((ulong)i == K)
                {
                    WriteLine(1);
                    return;
                }
            }
            WriteLine(line[i]);
        }
    }
    class D
    {
        List<Kukan> trains = new List<Kukan>();
        long[,] table;
        public void Solve()
        {
            var array = ReadLongArray();
            var N = array[0];
            var M = array[1];
            var Q = array[2];
            table = new long[N+1,N+1];
            for (int i = 0; i < M; i++)
            {
                var line = ReadIntArray();
                var L = line[0];
                var R = line[1];
                for (int j = 1; j <= L; j++)
                {
                    for (int k = R; k <= N; k++)
                    {
                        table[j, k]++;
                    }
                }
                //trains.Add(new Kukan(L, R));
            }
            //trains.OrderBy(x => x.L);
            for (int i = 0; i < Q; i++)
            {
                var lineq = ReadIntArray();
                var p = lineq[0];
                var q = lineq[1];
                WriteLine(table[p, q]);
                //long count = 0;
                //foreach (var item in trains.Where(x => x.L >= p && x.L <= q))
                //{
                //    if (item.R <= q) count++;
                //}
                //WriteLine(count);
            }
        }
    }
    struct Kukan
    {
        public Kukan(int l, int r)
        {
            L = l;
            R = r;
        }
        public int L, R;
    }
    public static class Util
    {
        /// <summary>
        /// 標準入力をint型にパースする
        /// </summary>
        /// <returns></returns>
        public static int ReadInt()
        {
            return int.Parse(ReadLine());
        }
        /// <summary>
        /// 標準入力をint型の配列にする
        /// </summary>
        /// <returns></returns>
        public static int[] ReadIntArray()
        {
            return ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        }
        /// <summary>
        /// 標準入力をlong型にパースする
        /// </summary>
        /// <returns></returns>
        public static long ReadLong()
        {
            return long.Parse(ReadLine());
        }
        /// <summary>
        /// 標準入力をlong型の配列にする
        /// </summary>
        /// <returns></returns>
        public static long[] ReadLongArray()
        {
            return ReadLine().Split(' ').Select(long.Parse).ToArray();
        }
        /// <summary>
        /// 一定値の数列を生成する
        /// </summary>
        /// <param name="value"></param>
        /// <param name="length"></param>
        /// <returns></returns>
        public static IEnumerable<long> ConstSeq(long value, long length)
        {
            for (int i = 0; i < length; i++)
            {
                yield return value;
            }
        }
        /// <summary>
        /// int配列の累積和を求める
        /// </summary>
        /// <param name="array"></param>
        /// <returns></returns>
        public static IEnumerable<int> CumulativeSum(IEnumerable<int> array)
        {
            int tmp = 0;
            foreach (var num in array)
                yield return tmp += num;
        }
        /// <summary>
        /// long配列の累積和を求める
        /// </summary>
        /// <param name="array"></param>
        /// <returns></returns>
        public static IEnumerable<long> CumulativeSum(IEnumerable<long> array)
        {
            long tmp = 0;
            yield return tmp;
            foreach (var num in array)
                yield return tmp += num;
        }
        /// <summary>
        /// 最大公約数をユークリッドの互除法で求める
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <returns></returns>
        public static long Gcd(long a, long b)
        {
            return b == 0 ? a : Gcd(b, a % b);
        }
        /// <summary>
        /// 最小公倍数を求める
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <returns></returns>
        public static long Lcm(long a, long b)
        {
            return a * b / Gcd(a, b);
        }
    }
}