A ladder kept inclined at an angle of 40° with a distance of 8 feet from the building touches the building at some height. If the same ladder is kept at a distance of 6 feet with an inclination of 50° then find the height at which the ladder touches the building.