Chaarshanbegaan at Cafebazaar | 프로그래밍의 벗 PivotOJ
PivotOJ

Chaarshanbegaan at Cafebazaar

시간 제한: 2000ms메모리 제한: 512MB출처: ICPC Asia Tehran Regional Contest 2018BOJ 16728
이 문제는 본문 이미지 일부가 표시되지 않습니다. 텍스트만으로 풀이가 어려울 수 있습니다.

문제

Chaarshanbegaan is a gathering event at Cafebazaar similar to TGIF events at Google. Some entertainment programs like pantomime, foosball, Xbox/PS4, and several board games are part of the event. You are going to set up a dart game in Chaarshanbegaan. As a techie organizing a game for techies, you would rather use a smart screen and write a program to calculate the scores instead of hanging a traditional dartboard and scoring the shots manually. Your program must get the coordinates of dart shots for a player and calculate his/her total score. The score for each dart shot (at point (x, y)) is calculated based on its distance from the center of the dartboard (point (0, 0)). If the distance is d millimeters, the score is calculated based on the following table:

[이미지 1]

입력

The first line of the input contains a single integer N as the number of dart shots for a player (1 ≤ N ≤ 100). Each of the next N lines contains two space-separated integers as the coordinates (x, y) of a dart shot. The coordinates are in millimeters and their absolute values will not be greater than 300.

출력

Print a single line containing the total score of the player.

예제

예제 1

입력
2
4 7
-31 -5
출력
18

예제 2

입력
3
12 -16
-180 100
152 10
출력
11
코드를 제출하려면 로그인하세요.