added BDD calculator beginning
calc mid