## Algorithm

Problem Name: beecrowd | 2057

# Time Zone

By Neilor Tonin, URI Brazil

Timelimit: 1

Paul and Peter have made a long journey since they left Brazil to compete in the ICPC World Finals, in Phuket, Thailand. They noticed that in each place where they stopped, they had to adjust their watches because of the time zone.

This way, to plan for upcoming trips, they asked you to create a mobile application that, given the departure time, travel time and the destination time zone with respect to the origin, you have to inform the time of arrival of each flight in the destination.

For example, if they left a place at 10 am for a 4 hour journey to a destination that is on the east, in a time zone with an extra hour with respect to the time zone of the starting point, the arrival time will be 10 hours + 4 hours + 1 hour (due de time zone), i.e. they will arrive at 15 hours. Note that if the calculated time is 24, its program should print 0 (zero).

## Input

The input contains 3 integers: S (0 ≤ S ≤ 23), T (1 ≤ T ≤ 12) y F (-5 ≤ F ≤ 5), separated by a space, respectively indicating the time of departure, the travel time and destination time zone with respect to the origin.

## Output

Print an integer that indicates the local time specified in destination, as the examples below.

 Input Samples Output Samples 10 7 3 20

 22 6 -2 2

 0 3 -4 23

## Code Examples

### #1 Code Example with C Programming

```Code - C Programming```

``````
#include <stdio.h>

int main(void)

{
int a, b, c, x;

scanf("%i %i %i", &a, &b, &c);

x=a+b+c;

if (x  <  0)
x=24+x;

else if (x < 24)
x=x;

else if (x==24)
x=0;

else if (x > 24)
x=x-24;

printf("%i\n", x);

return 0;
}
``````
Copy The Code &

Input

cmd
10 7 3

Output

cmd
20

### #2 Code Example with C++ Programming

```Code - C++ Programming```

``````
#include<stdio.h>
int main()
{
int a,b,c,now,then;
scanf("%d %d %d",&a,&b,&c);
if(a==0)a=24;
now=a+b;
then=now+c;
if(then>=24)
printf("%d\n",then-24);
else
printf("%d\n",then);
return 0;
}
``````
Copy The Code &

Input

cmd
10 7 3

Output

cmd
20

### #3 Code Example with Javascript Programming

```Code - Javascript Programming```

``````
var lines = input.split('\n');
var prompt = function(texto) { return lines.shift();};
var [S,T,F] = (prompt("Digite os Valores").split(" ")).map(Number)
var final = (S + T + F)
if(S==0){
S=24
}
var final = (S + T + F)
if (final >= 24){
final = final - 24
console.log(final)
}else if (final==24 && final==0){
console.log(final)
}else{
console.log(final)
}
``````
Copy The Code &

Input

cmd
10 7 3

Output

cmd
20

### #4 Code Example with Python Programming

```Code - Python Programming```

``````
S,T,F = map(int,input().split())
if S==0:
S=24
else:
``````
Copy The Code &

Input

cmd
10 7 3

Output

cmd
20