The accumulated criminal records shows that serious and minor crimes differ in many measures and are related in a complex way. While some of those who have committed minor crime spontaneously evolve into serious criminals, the transition from minor crime to major crime involves many social factors and have not been fully understood yet. In this work, we present a mathematical model to describe how minor criminals turns in to major criminals inside and outside of prisons. The model is design to implement two social effects which respectively have been conceptualized in popular terms "broken windows effect" and "prison as a crime school." Analysis of the system shows how the crime-related parameters such as the arrest rate, the period of imprisonment and the in-prison contact rate affect the criminal distribution at equilibrium. Without proper control of contact between prisoners, the longer imprisonment rather increases occurrence of serious crimes in society. An optimal allocation of the police resources to suppress crimes is also discussed.