add condition

added condition whether the number of beds i exceeded