Under construction

Still being built. Things may change

Sat Down

Interview

Time limit1sMemory limit256 MB

Summary
Given your two cards, count how many of the 18 choose 2 possible opponent hands you beat, and print the win probability to three decimals.
Level

Easy3 of 10

Topics
Brute force, Implementation, Math, Combinatorics
Solved
No attempts yet

Problem

Seotda, which means "stood up", is a Korean card game played by two or more people with 20 hwatu cards. Anjatda, which means "sat down", is a simplified version of it.

Anjatda uses cards numbered 1 to 10, two copies of every number, 20 cards in total. Exactly two people play.

The game runs like this.

  1. The two players take turns, and each of them takes 2 random cards out of the 20.
  2. A player cannot take a card the other player already took. You know which cards you took, but you do not know which cards the other player took.
  3. Both players reveal their hands.
  4. The player with the stronger hand rank wins. If the two players have the same rank, the game is a draw.

The ranks are listed strongest first.

  • 10-ttaeng: both cards are 10
  • 9-ttaeng: both cards are 9
  • ...
  • 2-ttaeng: both cards are 2
  • 1-ttaeng: both cards are 1
  • 9-kkeut: not a ttaeng, and the sum of the two cards leaves remainder 9 when divided by 10
  • 8-kkeut: not a ttaeng, and the sum of the two cards leaves remainder 8 when divided by 10
  • ...
  • 1-kkeut: not a ttaeng, and the sum of the two cards leaves remainder 1 when divided by 10
  • 0-kkeut: not a ttaeng, and the sum of the two cards leaves remainder 0 when divided by 10

For example, suppose Younghak holds 1 and 1 while his opponent holds 10 and 9. Younghak has 1-ttaeng and the opponent has 9-kkeut, so Younghak has the stronger rank and wins.

Younghak is shrewd and bets money only when his chance of winning is high. He has seen his own hand and knows nothing about his opponent's hand. The opponent takes 2 of the remaining 18 cards, and every choice of 2 cards is equally likely.

Given Younghak's hand, find the probability that Younghak wins. A draw does not count as a win.

Input

The first line contains two integers AA and BB, the two cards in Younghak's hand. (1≤A,B≤101 \le A, B \le 10)

Output

Print the probability that Younghak wins, rounded to three digits after the decimal point.

Trailing zeros must be printed. For example, 0.700 is correct and 0.7 is wrong.

Examples4

  1. Example 1

    Input
    1 1
    
    Expected output
    0.941
    
  2. Example 2

    Input
    1 2
    
    Expected output
    0.275
    
  3. Example 3

    Input
    1 9
    
    Expected output
    0.000
    
  4. Example 4

    Input
    10 10
    
    Expected output
    1.000