#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
	cin.tie(nullptr)->sync_with_stdio(false);
	int t,n;
	cin >> t >> n;
	vector<int>arr;
	set<int>s;
	set<int>mods;
	int cur = 100+t;
	while(true){
		if(s.find(cur/100-1)==s.end()&&cur!=100+t){
			arr.push_back(cur/100-1);
		}
		if(cur%100==t&&cur!=100+t)break;
		s.insert(cur/100);
		cur+=100+t;
	}
	int repeat = (cur-100-t)/100;
	n--;
	for(int i = 0; i<arr.size(); i++){
		if(n%arr.size()==i){
			//cout << i << "\n";
			//cout << arr[i] << "\n";
			cout << repeat*(n/arr.size())+arr[i] << "\n";
			return 0;
		}
	}
	return 0;
}
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = b - 1; i >= a; --i)
#define SORT(v) sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define REV(v) reverse(v.begin(), v.end())
#define ITER(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define LB(v, x) (lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (upper_bound(v.begin(), v.end(), x) - v.begin())
#define SZ(v) (int)v.size()
using namespace std;
using ll = long long;
using P = pair<int, int>;

class Main {
    int H, W;
    vector<string> S;
    void input() {
        cin >> H >> W;
        S.resize(H);
        REP(i, H) {
            cin >> S[i];
        }
    }
    void output() {
        int res = 0;
        REP(i, H) {
            REP(j, W) {
                if (S[i][j] == '#') continue;
                if (i < H - 1) {
                    if (S[i + 1][j] == '.') ++res;
                }
                if (j < W - 1) {
                    if (S[i][j + 1] == '.') ++res;
                }
            }
        }
        cout << res << endl;
    }

public:
    Main() {
        input();
        output();
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    Main();

    return 0;
}
