#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define FOR(i,a,b) for(int i=(a),_b=(b);i<(_b);++i) #define FORD(i,a,b) for(int i=(a),_b=(b);i>(_b);--i) #define pb push_back #define mp make_pair #define all(c) (c).begin(),(c).end() #define tr(c,i) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); i++) #define present(c,x) ((c).find(x) != (c).end()) #define cpresent(c,x) (find(all(c),x) != (c).end()) #define endl '\n' typedef long long ll; typedef unsigned long long ull; typedef unsigned char byte; typedef vector vi; typedef pair pii; typedef pair pll; typedef vector vpii; const int MX = 105; int a[MX][MX]; char g[MX][MX]; int main(int argc, char *argv[]) { #ifndef ONLINE_JUDGE freopen(argv[1],"r",stdin); #endif #ifndef ONLINE_JUDGE ifstream cin(argv[1]); #endif #if 0 ofstream cout(argv[2]); #endif ios :: sync_with_stdio(false); cin.tie(NULL); int n,m; cin >> n >> m; char c; FOR(i,0,n) FOR(j,0,m) cin >> g[i][j]; if (g[0][0] != '.') { cout << 0 << endl; return 0; } int ans = 1; int i = 0, j = 0; while (true) { if (i+1 < n && g[i+1][j] == '.') { ++i; ans++; } else if (j+1 < m && g[i][j+1] == '.') { ++j; ++ans; } else break; } cout << ans << endl; return 0; }