bottom calculation