/*Shovkoplyas Grigory in the house*/
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<ctime>
#include<cassert>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<string>
#include<vector>
#include<set>
#include<map>
using namespace std;

#define name "protocol"

char s[1000][1001];

int main()
{
  freopen(name".in", "r", stdin);
  freopen(name".out", "w", stdout);
  int n, m;
  scanf("%d%d%*c", &n, &m);
  for(int i = 0; i < n; i++)
    gets(s[i]);
  vector<int> a(n, 0), b(m, 0);
  for(int i = 0; i < n; i++)
    for(int j = 0; j < m; j++)
    {
      if(s[i][j] == '+')
        a[i]++, b[j]--;
      if(s[i][j] == '-')
        a[i]--, b[j]++;
      if(s[i][j] == '?')
        a[i]++, b[j]++;
    }
  /*for(int i = 0; i < n; i++)
    cout << a[i] << ' ';
  cout << endl;
  for(int i = 0; i < m; i++)
    cout << b[i] << ' ';
  cout << endl; */
  int ans = (int)-1e9;
  for(int i = 0; i < n; i++)
    for(int j = 0; j < m; j++)
    {
      if(s[i][j] == '?')
        ans = max(ans, a[i] + b[j] - 2);
      else
        ans = max(ans, a[i] + b[j]);
    }
  cout << ans << endl;
  return 0;
}

                                    

