Last Updated: 31 Oct, 2025

Diverse Committee Selection

Easy

Problem statement

A company is forming a 3-member committee for a social event. The pool of available employees consists of a number of men and women. To ensure diversity, the committee must have at least one man and at least one woman.


Given the number of men (M) and women (W) available, your task is to calculate the total number of unique ways a valid 3-member committee can be formed.


A committee is considered invalid if it consists of all men or all women.


Input Format:
The first and only line of input contains two space-separated integers, M (number of men) and W (number of women).


Output Format:
Print a single integer representing the total number of valid, diverse committees that can be formed.


Note:
The number of combinations can be large, so be sure to use a 64-bit integer type (like long in Java or long long in C++) for your calculations.