Problem:
Score : 100 points

Problem Statement

Takahashi, who is A years old, is riding a Ferris wheel.

It costs B yen (B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it for half the cost, and children who are 5 years old or younger are free of charge. (Yen is the currency of Japan.)

Find the cost of the Ferris wheel for Takahashi.

Constraints

0 ≤ A ≤ 100

2 ≤ B ≤ 1000

B is an even number.

Input

Input is given from Standard Input in the following format:

A B

Output

Print the cost of the Ferris wheel for Takahashi.

Sample Input 1

30 100

Sample Output 1

100

Takahashi is 30 years old now, and the cost of the Ferris wheel is 100 yen.

Sample Input 2

12 100

Sample Output 2

50

Takahashi is 12 years old, and the cost of the Ferris wheel is the half of 100 yen, that is, 50 yen.

Sample Input 3

0 100

Sample Output 3

0

Takahashi is 0 years old, and he can ride the Ferris wheel for free.

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <math.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll mod = 1000000007;
string L;
ll Q, q[200010][4], num, X, Y, bit[200010];
vector<P> xcd;
 
ll sum(ll i)
{
	ll s = 0;
	while (i > 0)
	{
		s += bit[i];
		i -= i & -i;
	}
	return s;
}
 
void add(ll i, ll x)
{
	while (i <= num)
	{
		bit[i] += x;
		i += i & -i;
	}
}
 
ll po(ll x, ll y)
{
	if (y == 0) return 1;
	if (y % 2)
	{
		return po(x, y - 1) * x % mod;
	}
	else
	{
		ll yyy = po(x, y / 2);
		return yyy * yyy % mod;
	}
}
 
ll div(ll x)
{
	return po(x, mod - 2);
}
 
int main(void)
{
	cin >> Q;
	for (int i = 0; i < Q; i++)
	{
		cin >> q[i][0];
		if (q[i][0] == 1)
		{
			cin >> q[i][1] >> q[i][2];
			xcd.push_back(P(q[i][1], i));
		}
	}
	num = xcd.size();
	sort(xcd.begin(), xcd.end());
	for (int i = 0; i < num; i++)
	{
		q[xcd[i].second][3] = i + 1;
	}
	ll t = 1;
	for (int i = 0; i < Q; i++)
	{
		if (i == 0)
		{
			X = q[i][1], Y = q[i][2];
			add(q[i][3], 1);
			t++;
		}
		else if (q[i][0] == 1)
		{
			ll half = (t + 1) / 2;
			add(q[i][3], 1);
			ll lb = 0, ub = num;
			while (lb + 1 < ub)
			{
				ll mid = (lb + ub) / 2;
				if (sum(mid - 1) >= half)
				{
					ub = mid;
				}
				else
				{
					lb = mid;
				}
			}
			if (t % 2 == 0)
			{
				Y += abs(xcd[lb - 1].first - X) + q[i][2] + abs(q[i][1] - xcd[lb - 1].first);
			}
			else
			{
				Y += abs(q[i][1] - xcd[lb - 1].first) + q[i][2];
				if (q[i][1] < X)
				{
					Y += 2 * abs(X - xcd[lb - 1].first);
				}
			}
			X = xcd[lb - 1].first;
			t++;
		}
		else
		{
			cout << X << ' ' << Y << endl;
		}
	}
	int www;
	cin >> www;
}