Mathematics of Justice