#include<iostream>
using namespace std;
//This program gets the number of day and the month in the Persian Calendar
//& determines where that date stands in the calendar
int main() {
	cout << "The Position of a Date in the Persian Calendar \n";
	cout << "To exit => Day = 0 and Month = 0 \n\n";
	while (true) {
		int d, m;
		cout << "Day = ";
		cin >> d;
		cout << "Month = ";
		cin >> m;
		if (m==0 && d==0) {
			cout << "The program is terminated. Bye";
			break;
		}
		int p;
		if (m>0 && m<7 && d>0 && d<32) {
			p = (m-1)*31 + d;
			cout << "Position = " << p << endl << endl;
		} else if (m>6 && m<13 && d>0 && d<31) {
			p = 186 + (m-7)*30 + d;
			cout << "Position = " << p << endl << endl;
		} else {
			cout << "Error: You have entered a wrong date! \n\n";
		}
	}
	return 0;
}
