Solved by 1293 users: ...
UserDateAttemptTimeCMSC
xtender`11 apr 2010`Perl2900.064
sb3ar`23 dec 2007`Ruby1600.0219
sb3ar`23 dec 2007`Ruby1700.0219
xtender`11 apr 2010`Perl2700.0519
sb3ar`11 dec 2007`Ruby1500.0223
xtender`11 apr 2010`Perl2400.0524
Nakilon`13 jan 2010`Ruby1200.0231
Nakilon`13 jan 2010`Ruby1400.0231
Nakilon`11 apr 2010`Ruby1600.0231
Nakilon`13 jan 2010`Ruby1300.0232
Nakilon`12 apr 2010`Ruby1800.0232
fetetriste`24 apr 2007`Ruby900.0235
fetetriste`24 apr 2007`Ruby800.0242
lacrosse`20 sep 2013`Ruby500.0246
borodiy_111`12 sep 2011`Scheme100.2646
var`24 apr 2007`Ruby400.0247
fetetriste`24 apr 2007`Ruby700.0248
pauc`29 dec 2011`Perl200.0448
Rocker`28 dec 2007`Ruby200.0249
harya_krishnii`13 oct 2009`Ruby200.0249
var`24 apr 2007`Ruby300.0249
 C++ 617 C 269 FPC 248 Java 68 Kylix 48 Ruby 29 Python 17 Perl 9 Scheme 6 Haskell 2 Lua 2
` >  >  >  >  >  >  >  >  >  > `

Random descending a tree

Time limit: 5 seconds

Input contains a description of a binary tree, every leaf of which has an integer number from the range -10^6 ... 10^6. Starting from the root, one randomly descends the tree, choosing left or right subtrees at each inner vertex with equal probabilities.

Find the expectation value of the number that we encounter after reaching a leaf. Output the answer with two decimal digits. The description of the tree is given in the following format:

```
tree ::= leaf | (tree tree);
leaf ::= integer;
```

For example,

(((3 5) 1) (9 4))

The number of vertices of the tree is less than 1000.

 SAMPLE INPUT: ```(((3 5) 1) (9 4)) ``` SAMPLE OUTPUT: ```4.50 ```

Athor:
Voroztsov Artem

 © acm.mipt DevGroupThe page was generated in 190ms