CF915F Imbalance Value of a Tree
Description
You are given a tree $ T $ consisting of $ n $ vertices. A number is written on each vertex; the number written on vertex $ i $ is $ a_{i} $ . Let's denote the function $ I(x,y) $ as the difference between maximum and minimum value of $ a_{i} $ on a simple path connecting vertices $ x $ and $ y $ .
Your task is to calculate .
Input Format
The first line contains one integer number $ n $ ( $ 1
Output Format
Print one number equal to .