num = gets.to_i sum = 0 if num > 1 for n in 1..num do sum = sum + n end else sum = num end puts sum