Problem:
Score: 100 points

Problem Statement

There is a train going from Station A to Station B that costs X yen (the currency of Japan).

Also, there is a bus going from Station B to Station C that costs Y yen.

Joisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus.

How much does it cost to travel from Station A to Station C if she uses this ticket?

Constraints

1 \leq X,Y \leq 100

Y is an even number.

All values in input are integers.

Input

Input is given from Standard Input in the following format:

X Y

Output

If it costs x yen to travel from Station A to Station C, print x.

Sample Input 1

81 58

Sample Output 1

110

The train fare is 81 yen.

The train fare is 58 ⁄ 2=29 yen with the 50% discount.

Thus, it costs 110 yen to travel from Station A to Station C.

Sample Input 2

4 54

Sample Output 2

31

Solution in C++14 (GCC 5.4.1) (judge verdict: Runtime Error)

#include "bits/stdc++.h"
#define rep(i,a,n) for(int i = a;i < n;i++)
typedef unsigned long long ull;
typedef long long ll;
using namespace std;

int n,m,cells[30][30] = {0},d[30][30] = {0},is_visited[30][30] = {0};

void dfs(int x,int y,int depth,int path){
	
    //if(y > 0) d[y-1][x] = min(d[y-1][x],path+cells[y-1][x]*(2*depth+1));
    if(y < n-1) d[y+1][x] = min(d[y+1][x],path+cells[y+1][x]*(2*depth+1));
    //if(x > 0) d[y][x-1] = min(d[y][x-1],path+cells[y][x-1]*(2*depth+1));
    if(x < m-1)	d[y][x+1] = min(d[y][x+1],path+cells[y][x+1]*(2*depth+1));
	
	/*
	if(y > 0 && !is_visited[y-1][x]){
		is_visited[y-1][x] = 1;
		dfs(x,y-1,depth+1,path+cells[y-1][x]*(2*depth+1));
		is_visited[y-1][x] = 0;
	}
	*/
	if(y < n-1 && !is_visited[y+1][x]){
		is_visited[y+1][x] = 1;
		dfs(x,y+1,depth+1,path+cells[y+1][x]*(2*depth+1));
		is_visited[y+1][x] = 0;
	}
  	/*
	if(x > 0 && !is_visited[y][x-1]){
		is_visited[y][x-1] = 1;
		dfs(x-1,y,depth+1,path+cells[y][x-1]*(2*depth+1));
		is_visited[y][x-1] = 0;
	}
    */
	if(x < m-1 && !is_visited[y][x+1]){
		is_visited[y][x+1]  =1;
		dfs(x+1,y,depth+1,path+cells[y][x+1]*(2*depth+1));
		is_visited[y][x+1] = 0;
	}
    return;
}

int main(){
    cin >> n >> m;
    rep(i,0,n){
        rep(j,0,m){
            cin >> cells[i][j];
            d[i][j] = 100000000;
        }
    }
    
    is_visited[0][0] = 1;
    d[0][0] = 0;
    dfs(0,0,0,0);
    
    cout << d[n-1][m-1] << endl;
    return 0;
}