input: Write a python function that calculates the number of valid (x, y) pairs where Alice must win a turn-based game on a circular field with flowers. Alice takes the first turn and can pick one flower either in the clockwise or anti-clockwise direction. The game rules are such that if a player cannot pick any flower, they capture their opponent and win. For two integers, n and m, determine the pairs (x, y) where x is the number of flowers in the clockwise direction and y is the number of flowers in the anti-clockwise direction, satisfying the conditions:
  - Alice wins the game.
  - x is in the range [1, n].
  - y is in the range [1, m].
  
  The function should return the number of such pairs.
  
  Examples:
  >>> n = 3, m = 2
  3
  >>> n = 1, m = 1
  0
  
  Constraints:
  1 <= n, m <= 10^5
output: def count_valid_pairs(n, m):
      return (n - 1) * m + (m - 1) * n