CF543B Destroying Roads

Description

In some country there are exactly $ n $ cities and $ m $ bidirectional roads connecting the cities. Cities are numbered with integers from $ 1 $ to $ n $ . If cities $ a $ and $ b $ are connected by a road, then in an hour you can go along this road either from city $ a $ to city $ b $ , or from city $ b $ to city $ a $ . The road network is such that from any city you can get to any other one by moving along the roads. You want to destroy the largest possible number of roads in the country so that the remaining roads would allow you to get from city $ s_{1} $ to city $ t_{1} $ in at most $ l_{1} $ hours and get from city $ s_{2} $ to city $ t_{2} $ in at most $ l_{2} $ hours. Determine what maximum number of roads you need to destroy in order to meet the condition of your plan. If it is impossible to reach the desired result, print -1.

Input Format

The first line contains two integers $ n $ , $ m $ ( $ 1

Output Format

Print a single number — the answer to the problem. If the it is impossible to meet the conditions, print -1.